mv folders/files without changing modified date?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers mv folders/files without changing modified date?
# 8  
Old 09-27-2010
There is no distinction between moving a file or a directory. On the same filesystem it involves updating some inodes: the parent directories from where what-you-are-moving came from, and the one for the parent directory where-you-are-moving-it-to. Neither of these affect the information in the "thing" you are moving.

Even across filesystems the last modification timestamp of a directory is not modified.
# 9  
Old 09-28-2010
This is on an NFS drive which is shared, so I can access it from RH5, Sun, HP, AIX, operating systems. On any of them, then I mv a folder into another folder, the original folder's modify time is changed to sysdate. The contents of the folder are not changed, but the folder itself is...
# 10  
Old 09-28-2010
Use "find" piped to "cpio -p". This is described in both "man find" and "man cpio". I can't go deeper because we do not know what Operating System version or Shell you have.
Hope this helps.
# 11  
Old 09-29-2010
MySQL

Try this:
tar cf - <FOLDER> | ( cd <new_location> ; tar xf - )
HTH Robert

Last edited by Egregius; 09-29-2010 at 11:22 AM.. Reason: Missed the source folder :)
# 12  
Old 09-29-2010
I'm a total rookie.. but if it's not too many folders, could you use:

Code:
touch -mt YYYYMMDDHHMM

After you used mv, to change the modified date back to whatever Date & Time you'd like?

Last edited by RiDE; 10-01-2010 at 09:02 AM..
# 13  
Old 09-29-2010
copy folders

Hi!. Suppose you want to move content from /srcfolder to /dstfolder...try this:
Code:
# cd /srcfolder
# find . -depth -print | cpio -pdumv /dstfolder

This will keep you files modification dates.

Hope this helps!
# 14  
Old 09-29-2010
A standard way to relocate directories:
Code:
tar cf - ./src  | ( cd /path; tar xfp -);

If you need to rename the destination use a mv command on the dest directory itself:
Code:
mv /path/src /path/dest

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Changing CSV files with date . Subtracting date by values

Hi All, I have a CSV file which is as below. Basically I need to take the year column in it and find if the year is >= 20152 . If that is then I should subtract all values by 6. In the below example in description I am having number mentioned as YYWW so I need to subtract those by -5. Whereever... (8 Replies)
Discussion started by: arunkumar_mca
8 Replies

2. UNIX for Dummies Questions & Answers

Changing cases of multiple files in different folders

I am a TA for a computer science course and we have a program that flags code that appears to the same as other code that is supplied. In order for the program to check all of the student's programs, the programs all need to be named exactly the same. However, students don't like to follow... (12 Replies)
Discussion started by: bpmawhin
12 Replies

3. Shell Programming and Scripting

How to get the files which has modified date as yesterday and before?

Hi All, Can you please help me to get only the files which has the modified date as yesterday and before? Thanks in advance! Regards, Velava.S (4 Replies)
Discussion started by: velava
4 Replies

4. Emergency UNIX and Linux Support

Is there any way to set the files modified date and stamp to last modifies time?

Actually i did modification in a file on server by mistake, now its showing current time stamp, is there any way to set the files modified date and stamp to last modifies time. Please advice here.Thanks in advance.:b: (7 Replies)
Discussion started by: saluja.deepak
7 Replies

5. Shell Programming and Scripting

FTP files modified after a particular date between servers

Hi all, i need to write a shell script to transfer a file modified after a particular date from one server to another. I searched for the related posts in this forum and got hints and snippets for it. i tried the below code ftp serverA user uname pwd lcd to_dir cd from_dir files=$(find... (7 Replies)
Discussion started by: mick_000
7 Replies

6. UNIX for Dummies Questions & Answers

Number of files in a directory modified on a date

Hi How to list all the files in a directory that are modified on a particular date? Also need to know the count,i.e number of files modified on a particular date. Thanks Ashok (1 Reply)
Discussion started by: ashok.k
1 Replies

7. UNIX for Dummies Questions & Answers

Find last modified date for many files

Hello all - I've looked and have not been able to find a "find" command that will list the last modified date of files within a specific directory and its subdirectories. If anyone knows of such a command it would be very much appreciated! If possible, I would like to sort this output and have... (5 Replies)
Discussion started by: MichaelH3947
5 Replies

8. UNIX for Dummies Questions & Answers

Create a list of files that were modified after a given date.

Hello Mates! I'm kinda new to unix and need to a solve a problem. Input: date Situation: With the given date I need to find a list of all such files starting from a given path that were modified after the given date. I experimented with the "find" with "-newer" but did not quite get it... (4 Replies)
Discussion started by: rkka
4 Replies

9. Linux

compare files in the system with last modified date

HI, I have some files in my Linux machine that are very old and occupy a HUGe amount of space. I am trying to delete these files from the system so that it will be easy for me to add some files. I would like to know if this can done through a Perl or a shell script. What i want to do is i... (6 Replies)
Discussion started by: bsandeep_80
6 Replies

10. Shell Programming and Scripting

List Files & Folders created/modified

Hello people, I want to list the files & folders created/modified since a particular date say June 2006. I know I can list recursively thru the folders and use awk to extract the date column to get the desired output. Just wanted to check whether there is an easier way to do this. Please... (2 Replies)
Discussion started by: tipsy
2 Replies
Login or Register to Ask a Question