Tagged Questions
1
vote
1answer
257 views
rename files maching specific mtime value within directory
I use simple set of shell commands to in order to create mysqldumps daily. The script is called by cron daemon. It looks like:
presentdate="`date +%d-%m-%Y_%H:%M.%S`"
basedir="/var/db_my_backup"
...
11
votes
2answers
2k views
Prepending a timestamp to each line of output from a command
I wish to prepend a timestamp to each line of output from a command. For example:
foo
bar
baz
would become
[2011-12-13 12:20:38] foo
[2011-12-13 12:21:32] bar
[2011-12-13 12:22:20] baz
...where ...
2
votes
4answers
190 views
Access the last file (alphabetically) in a directory
I'm trying to open a file with vim from the command line, the file is in a directory filled with automatically generated files that are prepended with a time stamp. Since I don't know the time stamps ...
6
votes
6answers
4k 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
770 views
Delete files based on year
I need to delete all files in a directory that were created in 2009. What command can I use to do that?