Tagged Questions
1
vote
1answer
80 views
Move huge number of files into date structured directory order
I have about 1 million files in this directory: /home/username/images/
Each of the files are called something like: 012345678910(Place)_0_20120414185957_28841.jpg with the timestamp part of the ...
1
vote
3answers
96 views
Can I list only specific subdirectories?
I have a folder tree structure like
arndell
\_databases
\_daily
\_weekly
claremont
\_databases
\_daily
\_weekly
monte
\_databases
\_daily
\_weekly
and I am only after all files inside ...
1
vote
3answers
207 views
File extensions for unix shell scripts
On wikipedia, the article for .sh says:
For the .sh file extension type, see Bourne shell.
How about other unix shells?
I know that the shebang is used inside the file to indicate an ...
6
votes
1answer
89 views
How to start tailing a file that has not been yet created
I use tail to monitor the progress of jobs that I know will write their progress to disk. Almost always, I know which file they will create before they start running (the jobs are dispatched by a ...
5
votes
6answers
828 views
Shell script for moving oldest files?
How do I write a script for moving just the 20 oldest files from one folder to another? Is there a way to grab the oldest files in a folder?
3
votes
3answers
98 views
Delete files in a directory which are also in another directory
I copied a directory using this:
cp -r dir/ ../../
without thinking and realized that it copied the contents of dir instead of actually dir to the above directory. Now I have a mess of files I need ...
9
votes
2answers
357 views
How can I delete all files in a folder that haven't been accessed in a certain amount of time?
I'd like to run a nightly cron job that deletes all the files in a folder that haven't been accessed in a week or more. What is the most efficient way to do this in bash?
1
vote
2answers
157 views
Creating an empty file having a variable name in a script
I need to create an empty file using a shell script. The filename will be determined by examining all the files in a directory matching a pattern, say TEST.*, and appending _END to it so that the new ...