- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Move 2004 files to new folder
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2006 08:07 PM
05-08-2006 08:07 PM
I need to move all 2004 files from a directory to new one. Is there any way to do that with just one command?
Thanks in advance for your help.
Regards,
Carles
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2006 08:11 PM
05-08-2006 08:11 PM
Re: Move 2004 files to new folder
You can use # cp -R /
-Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2006 08:11 PM
05-08-2006 08:11 PM
Re: Move 2004 files to new folder
for FILE in `cat LIST`
do
mv $FILE /new_dir/
done
GOOD LUCK!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2006 08:17 PM
05-08-2006 08:17 PM
Re: Move 2004 files to new folder
you wanted to move (not copy) the directory:
mv dir1 dir2
(in effect a reneame of the directory)
Otherwise you may find the command returning problem with number of files being copied.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2006 08:17 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2006 08:23 PM
05-08-2006 08:23 PM
Re: Move 2004 files to new folder
Or is it all files in one folder, that is created in the year 2004?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2006 08:23 PM
05-08-2006 08:23 PM
Re: Move 2004 files to new folder
Hi Carles,
You can use
# cp -p -r /dir1/* /dir2/
It will copy subdirectories as well with same permissions.
Cheers,
Raj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2006 08:30 PM
05-08-2006 08:30 PM
Re: Move 2004 files to new folder
$ cd olddir
$find . -depth -print | cpio -pdm newdir
rgs,
ran
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2006 08:36 PM
05-08-2006 08:36 PM
Re: Move 2004 files to new folder
Mark Syder (like the drink but spelt different)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2006 09:34 PM
05-08-2006 09:34 PM
Re: Move 2004 files to new folder
Thanks for your replies, but as Mark said I need to move all files modified in 2004.
About any possibility to move files with size of 2004, 12004,... I can check it before and in case there aren't I can execute command sent by Enrico.
Regards,
Carles
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2006 10:03 PM
05-08-2006 10:03 PM
Re: Move 2004 files to new folder
find /xxx -mtime +NNNNN -exec mv {} /newdir \;
If you can somehow use mtime to select files from 2004....
There also is an option -newer (so maybe there is an older too so you could say older than a particular file... If there is not you can add "!" to say not newer than).
You can create a file of the correct date with touch -t YYMMDDhhmm FILE to compare against.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2006 11:34 PM
05-08-2006 11:34 PM
Re: Move 2004 files to new folder
Thanks to all for your help!
Regards,
Carles