Moving Directories Based on Modified date


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Moving Directories Based on Modified date
# 1  
Old 09-11-2010
Moving Directories Based on Modified date

Hi,

How can I move directories (and all sub directories/files) from one directory to another based on the modified date of the directory?

Currently the existing structure looks like this:

/public_html/media/videos/tmb/34947/image1.jpg
/public_html/media/videos/tmb/34947/image2.jpg

34947 is the VideoID

For instance I want to extract all the video directories that have a modified date of 05-01-2010 through 05-31-2010(may 2010), and place them in their own directory like so:

/public_html/media/videos/tmb/05-2010/34947/image1.jpg

How can I get this to work?

Thanks in Advance

Larry B. Smilie

Last edited by lbargers; 09-11-2010 at 02:19 PM..
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to copy creation date over top of modified date?

Can someone draw up a script that for every file, folder and subfolder and files that will copy the creation date over top of the modified date?? I know how to touch every file recursively, but no idea how to read a files creation date then use that to touch the modification date of that file,... (3 Replies)
Discussion started by: toysareforboys
3 Replies

2. Shell Programming and Scripting

Archiving and moving files into directories, creating directories, etc.

how can i move "dataName".sql.gz into a folder called 'database' and then move "$fileName".tar.gz * .htaccess into a folder called 'www' with the entire gzipped file being "$fileName".tar.gz? Is this doable or overly complex. so mydemo--2015-03-23-1500.tar.gz > database -... (5 Replies)
Discussion started by: wyclef
5 Replies

3. UNIX for Dummies Questions & Answers

Script moving files based on date

Hi, I need a script that moves files based on date to a folder. The folder should be created based on file date. Example is : Date file name ----- -------- Oct 08 07:39 10112012_073952.xls Oct 09 07:39 10112012_073952.xls Oct 10 07:39 ... (6 Replies)
Discussion started by: rockingvj
6 Replies

4. Shell Programming and Scripting

Moving files from one directory to another based on 2 date variables

Hi All, I am currently coding for a requirement(LINUX OS) where I am supposed to move a file (Lets Call it Employee.txt) from Directory A to Directory B based on 2 date fields as below, Date_Current = 20120620 Date_Previous = 20120610 Source Directory : /iis_data/source Target... (11 Replies)
Discussion started by: dsfreddie
11 Replies

5. Shell Programming and Scripting

mp3 tag/rename based on creation (last modified date)

Arg, I'm trying to figure out how to create a album tag based on the last modified date stamp for files which don't have a corresponding .talk file. IE. 2009 12 10 - Talk Radio.mp3 is how I want them structured, they should all have a corresponding .talk file so my mp3 player can speak the name ie... (0 Replies)
Discussion started by: mrplow
0 Replies

6. UNIX for Dummies Questions & Answers

Find most recently modified directories

How do I do it? Simple answers preferred... using BASH.. the less code the better. I want to find out where Indesign is caching PDF tmp data ... I figure this is a good way to do it.. either way i wanna know how to do it. (2 Replies)
Discussion started by: glev2005
2 Replies

7. Shell Programming and Scripting

Identifying New and Modified Files/Directories

Hi. Our shop is migrating to a new UNIX server and our hope is to do a full migration of all files to the new server weeks in advance of the final migration. As a result we want to identify files on our SOLARIS 8 UNIX server that have changed or that were created after a specific date & time... (2 Replies)
Discussion started by: buechler66
2 Replies

8. Shell Programming and Scripting

Last modified file in 2 or more directories

Hi, Is there any simple way to get the last modified file in a set of 2 or more directories? This should return one file only (not 1 file per directory) Thanks for your help (4 Replies)
Discussion started by: m69w
4 Replies

9. Shell Programming and Scripting

moving directories to new directories on multiple servers

Hi - I am new to unix scripts...I need to move several directories on multiple servers to new directories. (0 Replies)
Discussion started by: mackdaddy07
0 Replies

10. UNIX for Dummies Questions & Answers

Moving files based on creation date

Howdy, I'm trying to figure out how to move multiple files based on their creation date. If anyone can enlighten me it would be most appreciated!! Thanks! :D (1 Reply)
Discussion started by: dgoyea
1 Replies
Login or Register to Ask a Question
ar(1)							      General Commands Manual							     ar(1)

Name
       ar - archive and library maintainer

Syntax
       ar option [ posname ] archive file ...

Description
       The archiver ar maintains groups of files as a single archive file.  This utility is generally used to create and update library files that
       the link editor uses; however, you can use the archiver for other similar purposes.  This version uses a portable ASCII-format archive that
       you can use on various machines that run UNIX.  If you have an archive that uses an older format, see

Options
       This  section  describes the options and suboptions that you can use with the ar utility.  Suboptions must be specified with options.  Fol-
       lowing is a list and description of the options:

       d      Deletes the specified files from the archive file.

       r      Replaces the specified files in the archive file.  If you use the suboption u with r, the archiver only replaces	those  files  that
	      have  last-modified  dates later than the archive files.	If you use a positioning character (from the set abi) you must specify the
	      posname argument to tell the archiver to put the new files after (a) or before (b or i).	Otherwise, the archiver puts new files	at
	      the end of the archive.

       q      Appends  the specified files to the end of the archive file.  The archiver does not accept suboption positioning characters with the
	      q option.  It also does not check whether the files you want to add already exist in the archive.  Use the q option  only  to  avoid
	      quadratic behavior when you create a large archive piece by piece.

       t      Prints  a  table of contents for the files in the archive file.  If you do not specify any filenames, the archiver builds a table of
	      contents for all files.  If you specify filenames, the archiver builds a table of contents only for those files.

       p      Prints the specified files from the archive.

       m      Moves the specified files to the end of the archive.  If you specify a positioning character, you must also specify the posname  (as
	      in option r) to tell the archiver where to move the files.

       x      Extracts	the  specified	files  from  the  archive.  If you do not specify any filenames, the archiver extracts all files.  When it
	      extracts files, the archiver does not change any file.  Normally, the last-modified date for each extracted file shows the date when
	      someone extracted it; however, when you use o, the archiver resets the last-modified date to the date recorded in the archive.

       s      Makes a symbol definition (symdef file) as the first file of an archive.	This file contains a hash table of ranlib structures and a
	      corresponding string table. The symdef file's name is based on the byte ordering of the hash table and  the  byte  ordering  of  the
	      file's target machine.  Files must be consistent in their target byte ordering before the archiver can create a symdef file.  If you
	      change the archive contents, the symdef file becomes obsolete because the archive file's	name  changes.	 If  you  specify  s,  the
	      archiver	creates the symdef file as its last action before finishing execution.	You must specify at least one other archive option
	      (m, p, q, r, or t) when you use the s option.  For UMIPS-V, archives include member objects based on  the  definition  of  a  common
	      object only.  For UMIPS-BSD, they define the common object, but do not include the object.

       v      Gives  a	file-by-file description as the archiver makes a new archive file from an old archive and its constituent files.  When you
	      use this option with t, the archiver lists all information about the files in the archive.  When you use this  option  with  p,  the
	      archiver precedes each file with a name.

       c      Suppresses  the  normal message that the archiver prints when it creates the specified archive file.  Normally, the archiver creates
	      the specified archiver file when it needs to.

       l      Places temporary files in the local directory.  If the l option is not used then the value of the  environment  symbol,  TMPDIR,	is
	      used  as the directory for temporary files.  If TMPDIR is not defined or if the directory it references is not writable then /tmp is
	      used.

       The suboptions do these things:

       a      Specifies that the file goes after the existing file (posname).  Use this suboption with the m or r options.

       b      Specifies that the file goes before the existing file (posname).	Use this suboption with the m or r options.

       i      Specifies that the file goes before the existing file (posname).	Use this suboption with the m or r options.

       o      Forces a newly created file to have the last-modified date that it had before it was extracted from the archive.	Use this suboption
	      with the x option.

       u      Prevents	the archiver from replacing an existing file unless the replacement is newer than the existing file.  This option uses the
	      UNIX system last modified date for this comparison.  Use this suboption with the r option.

Restrictions
       If you specify the same file twice in an argument list, it can appear twice in the archive file.

       The o option does not change the last-modified date of a file unless you own the extracted file or you are the superuser.

       This command truncates filenames to 15 characters.

Files
       /tmp/v*	 temporaries

See Also
       lorder(1), ld(1), odump(1), ranlib(1), ranhash(3x), ar(5), arcv(8)

								       RISC								     ar(1)