Unix/Linux Forum: script to move files with directory structure - Unix/Linux Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

script to move files with directory structure Rate Topic: -----

#1 User is offline   Darshak Icon

  • Newbie (User Level: 0/10)
  • Group: Members
  • Posts: 7
  • Joined: 05-May 08

Posted 19 May 2009 - 09:36 PM

:rolleyes: Hi,

Want to write a script which move like:
these are files in different dir structure,

/home/darshak/test/sh/new.txt
/home/darshak/test/new1.txt
/home/darshak/test/pl/file.txt

to same structure as above but in different dir,

/usr/local/test/sh/new.txt
/usr/local/test/new1.txt
/usr/local/test/pl/file.txt

I am finding files by below command which I have to move:
find /home/darshak -name "*" -mtime +4
0

#2 User is offline   vibhor_agarwalin Icon

  • User Level: 7/10
  • PipPipPipPipPipPipPip
  • Group: Members
  • Posts: 574
  • Joined: 24-June 05

Posted 25 May 2009 - 06:54 AM

Use dirname to find the directory structure of your file.
Create that structrue & then fire a copy command.
Vibhor Kumar Agarwal
0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



Cambridge Plus :: Cambridgeshire Steam Rally :: USB Temperature Monitor :: Classic British Motorbike Piston Rings
Unix Man Pages / Linux Man Pages :: HiFi Forum :: A14 Comments :: UNIX/Linux Forum Archives