Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Finding and moving directories but maintaining the tree - doable? 1

Status
Not open for further replies.

stla

IS-IT--Management
Mar 12, 2003
190
DE
(Elementary user)

My goal is to find and move directories with a certain date, and move them 'intact' to a new location.

My script below is working but it's putting the contents of the directories it finds 'loosely' in the target folder.

e.g. the script finds the directories 'ABC' and 'XYZ' but it places the CONTENTS thereof in/raid/legacy_data/


find . -type d -mtime 1 -name '*' -exec mv {} /raid/legacy_data/ \;


Is there a way of achieving:
/raid/legacy_data/ABC/content
/raid/legacy_data/XYZ/content
...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top