All Questions
13 questions
0
votes
1
answer
844
views
Failing string replacement in xargs command
I am trying to automatically create symlinks to directories and to replace a certain text string (foo) of the original name in the link name (bar). The name of the target directories may contain ...
0
votes
1
answer
69
views
How to filter files which have permissions changed in last n minutes
Example, I have two files
-rw-rw---- 1 1000 1000 5 Sep 28 01:25 file1
-rw-rw---- 1 1000 1000 13 Sep 28 01:25 file2
After echo "asdfg" >> file1 (file1 content was modified)
-rw-rw---- 1 ...
0
votes
1
answer
83
views
Processing image files once and only once without missing any
I have a wordpress installation with a large number (millions) of images. I want to optimize those images using ImageMagick mogrify but I only want to process them once (processing them over and over ...
1
vote
1
answer
806
views
Delete all folder not containing filename matching glob/regex
I want to do the following. I have depth 2 file hierarchy like this:
A
| B
| | g
| | h50000
| C
Where A, B, C are folders. I want to delete all folders without files matching specific patters, (in ...
0
votes
1
answer
70
views
Find old files in directory
I'm writing backup rotation script, that suppose to take all files older then 5 days and delete them.
Problem is that i've got some weird search results.
for example:
[root@spr1-nas01 storage]# date
...
0
votes
3
answers
2k
views
Exclude with the find command [duplicate]
I need some help getting the find command to work right in a script working on. I need to be able to exclude some directories. Below I have what I'm doing as a work around.
sudo find / ( -name ...
1
vote
3
answers
3k
views
How to get a debug output from the find command?
I have the following find command:
find /home/ -type d -name "something"
what I want to achieve is to know which directory/file is checked by the find command no matter the fact that it does or ...
1
vote
2
answers
1k
views
find: how to not have errors (stderr) when no files exists
I have a custom script which gzip log files when they are one day old. In my script all errors (stderr) are logged to a file and at the end of the script I use this file to know if its execution was ...
0
votes
2
answers
1k
views
Recursively delete empty folders with verbose output
This should be fairly simple, but I am not sure what i'm missing.
I'd like to recursively delete empty directories, and get an output for what's being deleted, this command works for sure, but I just ...
2
votes
3
answers
3k
views
Running a script containing find with a regexp fails in cron but works in a shell
I have the following script in my /etc/cron.d:
19 15 * * * root /opt/scripts/clean-nexus-release-repo.sh
The clean-nexus-release-repo.sh script looks like this:
#!/bin/bash
find /opt/sonatype-work/...
0
votes
4
answers
649
views
Calculate disk space occupied by many .png files
I have 357 .png files located in different sub dirs of the current dir:
settings# find . -name \*.png |wc -l
357
settings# find . -name \*.png | head
./assets/authenticationIcons/audio.png
./...
1
vote
3
answers
10k
views
Recursively rename files using find and sed
I want to go through a bunch of directories and rename all files that end in _test.rb to end in _spec.rb instead. It's something I've never quite figured out how to do with bash so this time I thought ...
0
votes
3
answers
1k
views
Scripts help FIND command via atime output to multiple files
here is a script I have wrote that I need help with. in the script I do a find for any file that has not been access for over 30 days, 60, 90, 180, 270 & 365 days.
This works just fine. however, ...