Prev: ~~~~~~~~~~~~~~ WATERBED MATTRESS ~~~~~~~~~~~~~~
Next: Redirect stdout and stderr preserving the original order
From: Danish on 27 Dec 2009 00:15 Hi, There is a directory with many subdirectories and many files in these subdirectories. I wanna list out files (just their creation date and path) created on Dec 25th and before from all the subdirectories excluding certain subdirectories eg BACKUP, N*. So I fired the find command from the respective directory as follows: find . name BACKUP -prune -mtime 1 -o -ls -print > $HOME/some_file In the above case I'm not able to list out certain subdirectories I wanna leave out by specifying a pattern for those subdirectories I also tried the below but this does not allow me to skip certain directories and also does not give me the correct output: ls -ltr * |tr -s " "| awk -f " " 'print {$6,$7,$8,$9}' I'm unable to figure what other additions I have to make to any of the above commands to get exactly what I want. Please provide me your inputs
From: wfw on 27 Dec 2009 14:39
On Dec 27, 12:15 am, Danish <me.linuxad...(a)gmail.com> wrote: > Hi, > > There is a directory with many subdirectories and many files in these > subdirectories. I wanna list out files (just their creation date and > path) created on Dec 25th and before from all the subdirectories > excluding certain subdirectories eg BACKUP, N*. First of all, there is no 'creation date'. Only change and modification dates. > So I fired the find command from the respective directory as follows: > > find . name BACKUP -prune -mtime 1 -o -ls -print > $HOME/some_file > > In the above case I'm not able to list out certain subdirectories I > wanna leave out by specifying a pattern for those subdirectories You can specify patterns; just quote them to escape the shell globbing. Also, you must group using parentheses. E.g.: find . \( -name BACKUP -o -name 'N*' \) -type d -prune -o -mtime +1 -type f -ls >$$HOME/some_file (split across lines for clarity - the command is one line.) I changed "-mtime 1" to "-mtime +1" since you said you wanted the files from the 25th and before, not just the 25th. Also I added '-type f' to deselect directories. This may not be what you want since it also deselect pipes, symbolic links, etc. |