Sponsored Content
Operating Systems Solaris Find a file and xarg mv to append date to file Post 302355424 by jlliagre on Tuesday 22nd of September 2009 04:48:59 PM
Old 09-22-2009
Try that one:
Code:
find . \! -name \*gz -mtime +7 -type f -exec sh -c 'mv "$0" "$0".$(date +%Y-%m-%d)' {} \;

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need a script to Append date to generated .txt file

Hi, Can anyone plz share their experience with - Building shell script to append the file with date in following format- Filename_MMDDYYYY.txt Thanks in advance (2 Replies)
Discussion started by: prince_of_focus
2 Replies

2. Shell Programming and Scripting

Append date to a file from CRON

Hi, I am trying to append date in DAY_Mon_dd_yyyy at the end of a filename from cron. Cron entry looks as below. (script to execute) > test_file_`date +"a_%b_%d_%Y"` File name created after executing the job is test_file_ I am expecting the filename to be something like ... (8 Replies)
Discussion started by: dncs
8 Replies

3. Shell Programming and Scripting

append date to file

Hi I need to append date to filename.Wrote script to get the date from table ,take this date filed and append to my i/p file when call the below script.Any help should be appreciated . Exampel If call the below script a4.sh filename o/p should be filename.2008-02-29 .... (6 Replies)
Discussion started by: mohan705
6 Replies

4. Solaris

gzip a file and append creation date stamp to file

I want to gzip a file and append the creation date to the end of the file. How can I accomplish this task. Basically they are log files which need a creation date stamp appended to make sure they do not overwrite other log files. -jack (3 Replies)
Discussion started by: jacktravine
3 Replies

5. UNIX for Dummies Questions & Answers

Find, copy, and append into one file

Hi, I am trying to do something relatively easy, but am having some trouble getting it to work. I have multiple files called "distances.log" in numerous subdirectories and sub-subdirectories within a directory. I would like the contents of each of these "distances.log" files to be appended to a... (2 Replies)
Discussion started by: euspilapteryx
2 Replies

6. UNIX for Dummies Questions & Answers

How To Append Date to File Name - AIX 5.3

Hello, I am a novice user on an AIX 5.3 system. I am running some scripts via crontab and redirecting the output to a file. For example: /home/cognos/ppdev_refresh.sh > /home/cognos/ppdev_refresh.txt I want to append the system date to the file name so it becomes:... (7 Replies)
Discussion started by: Maurice Frank
7 Replies

7. UNIX for Dummies Questions & Answers

append file name with date

Hi guys, I created a very basic script that moves a specified file to a directory that I have set using the mv command. What I would like to do is append the file name with the date and time. So if I was to use the script to move a file called abc.txt, the script should rename the file... (1 Reply)
Discussion started by: jjc
1 Replies

8. Shell Programming and Scripting

Delete log files content older than 30 days and append the lastest date log file date

To delete log files content older than 30 days and append the lastest date log file date in the respective logs I want to write a shell script that deletes all log files content older than 30 days and append the lastest log file date in the respective logs This is my script cd... (2 Replies)
Discussion started by: sreekumarhari
2 Replies

9. Shell Programming and Scripting

Want it to read the file name and then append date stamp at the end of file?

I was thinking something like for i in `find . -name "*.log.Z"`; do mv $i name.log.Z or something like that? (3 Replies)
Discussion started by: xgringo
3 Replies

10. Shell Programming and Scripting

Append orginal file date to end of file

Trying to process 1000 or so files. Take original date and append to end of file. Like so: tstpls42.bas tstpls42.bas.Sep-11--2011 Been working along these lines: date=`ll tstpls42.bas |cut -c 46-57 |sed -e 's/]/\-/g' | grep -v '^$'` for i in *.bas ; do j=`ll $i /hpdump/b1 | awk... (1 Reply)
Discussion started by: joeadmin
1 Replies
FIND2PERL(1)						 Perl Programmers Reference Guide					      FIND2PERL(1)

NAME
find2perl - translate find command lines to Perl code SYNOPSIS
find2perl [paths] [predicates] | perl DESCRIPTION
find2perl is a little translator to convert find command lines to equivalent Perl code. The resulting code is typically faster than running find itself. "paths" are a set of paths where find2perl will start its searches and "predicates" are taken from the following list. "! PREDICATE" Negate the sense of the following predicate. The "!" must be passed as a distinct argument, so it may need to be surrounded by whitespace and/or quoted from interpretation by the shell using a backslash (just as with using find(1)). "( PREDICATES )" Group the given PREDICATES. The parentheses must be passed as distinct arguments, so they may need to be surrounded by whitespace and/or quoted from interpretation by the shell using a backslash (just as with using find(1)). "PREDICATE1 PREDICATE2" True if _both_ PREDICATE1 and PREDICATE2 are true; PREDICATE2 is not evaluated if PREDICATE1 is false. "PREDICATE1 -o PREDICATE2" True if either one of PREDICATE1 or PREDICATE2 is true; PREDICATE2 is not evaluated if PREDICATE1 is true. "-follow" Follow (dereference) symlinks. The checking of file attributes depends on the position of the "-follow" option. If it precedes the file check option, an "stat" is done which means the file check applies to the file the symbolic link is pointing to. If "-follow" option follows the file check option, this now applies to the symbolic link itself, i.e. an "lstat" is done. "-depth" Change directory traversal algorithm from breadth-first to depth-first. "-prune" Do not descend into the directory currently matched. "-xdev" Do not traverse mount points (prunes search at mount-point directories). "-name GLOB" File name matches specified GLOB wildcard pattern. GLOB may need to be quoted to avoid interpretation by the shell (just as with using find(1)). "-iname GLOB" Like "-name", but the match is case insensitive. "-path GLOB" Path name matches specified GLOB wildcard pattern. "-ipath GLOB" Like "-path", but the match is case insensitive. "-perm PERM" Low-order 9 bits of permission match octal value PERM. "-perm -PERM" The bits specified in PERM are all set in file's permissions. "-type X" The file's type matches perl's "-X" operator. "-fstype TYPE" Filesystem of current path is of type TYPE (only NFS/non-NFS distinction is implemented). "-user USER" True if USER is owner of file. "-group GROUP" True if file's group is GROUP. "-nouser" True if file's owner is not in password database. "-nogroup" True if file's group is not in group database. "-inum INUM" True file's inode number is INUM. "-links N" True if (hard) link count of file matches N (see below). "-size N" True if file's size matches N (see below) N is normally counted in 512-byte blocks, but a suffix of "c" specifies that size should be counted in characters (bytes) and a suffix of "k" specifies that size should be counted in 1024-byte blocks. "-atime N" True if last-access time of file matches N (measured in days) (see below). "-ctime N" True if last-changed time of file's inode matches N (measured in days, see below). "-mtime N" True if last-modified time of file matches N (measured in days, see below). "-newer FILE" True if last-modified time of file matches N. "-print" Print out path of file (always true). If none of "-exec", "-ls", "-print0", or "-ok" is specified, then "-print" will be added implicitly. "-print0" Like -print, but terminates with instead of . "-exec OPTIONS ;" exec() the arguments in OPTIONS in a subprocess; any occurrence of {} in OPTIONS will first be substituted with the path of the current file. Note that the command "rm" has been special-cased to use perl's unlink() function instead (as an optimization). The ";" must be passed as a distinct argument, so it may need to be surrounded by whitespace and/or quoted from interpretation by the shell using a backslash (just as with using find(1)). "-ok OPTIONS ;" Like -exec, but first prompts user; if user's response does not begin with a y, skip the exec. The ";" must be passed as a distinct argument, so it may need to be surrounded by whitespace and/or quoted from interpretation by the shell using a backslash (just as with using find(1)). "-eval EXPR" Has the perl script eval() the EXPR. "-ls" Simulates "-exec ls -dils {} ;" "-tar FILE" Adds current output to tar-format FILE. "-cpio FILE" Adds current output to old-style cpio-format FILE. "-ncpio FILE" Adds current output to "new"-style cpio-format FILE. Predicates which take a numeric argument N can come in three forms: * N is prefixed with a +: match values greater than N * N is prefixed with a -: match values less than N * N is not prefixed with either + or -: match only values equal to N SEE ALSO
find, File::Find. perl v5.12.4 2013-03-18 FIND2PERL(1)
All times are GMT -4. The time now is 03:08 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy