The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Moving files not directory. senthil_is Shell Programming and Scripting 1 05-09-2008 02:21 AM
Getting unusual error - moving files to another directory aismann Shell Programming and Scripting 4 12-21-2007 03:29 AM
Mutiple For loops - moving files to another directory tekster757 Shell Programming and Scripting 9 06-21-2007 09:42 AM
How to Compress files before moving them in a directory godalle Shell Programming and Scripting 3 11-10-2005 11:59 AM
moving files from a unix directory to a windows directory gleads UNIX for Dummies Questions & Answers 2 08-29-2002 09:42 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-26-2008
gav_dhiman gav_dhiman is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 10
Moving all user files to another/new directory

Hi Experts,

I need your help for a new query. Query is to move all specified user files from a specified directory to another directory.

eg

i've 5 files in /export/home/users created by the gaurav(unix ID). i want to move all 5 files of gaurav from /export/home/users to /export/home/users/new_folder.

Thanks in advance.

regards,
Gaurav
  #2 (permalink)  
Old 08-26-2008
vbe's Avatar
vbe vbe is offline Forum Staff  
Moderator
  
 

Join Date: Sep 2005
Location: Switzerland - GE
Posts: 1,576
Is the old directory to remain?
  #3 (permalink)  
Old 08-26-2008
gav_dhiman gav_dhiman is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 10
Yes, please. It contain lot of other stuff too from other users.
  #4 (permalink)  
Old 08-26-2008
elzalem's Avatar
elzalem elzalem is offline
Registered User
  
 

Join Date: Nov 2006
Location: Lebanon
Posts: 33
$ cd /export/home/users/
$ mkdir ./new_folder
$ cp ./file1 ./file2 ./file3 ./file4 ./file5 ./new_folder/

this will copy the 5 files to 'new_folder'

if u want to move them, simply type mv instead of cp

hope this is what you need
  #5 (permalink)  
Old 08-26-2008
vbe's Avatar
vbe vbe is offline Forum Staff  
Moderator
  
 

Join Date: Sep 2005
Location: Switzerland - GE
Posts: 1,576
go to the directory, get the user UID (id user).

then
mv or cp -pR $(find . -user UID -print) ~newdirectory
(but after cp you will have to remove them the same way... but at least you can see if the files copied are what you wanted...)
  #6 (permalink)  
Old 08-26-2008
elzalem's Avatar
elzalem elzalem is offline
Registered User
  
 

Join Date: Nov 2006
Location: Lebanon
Posts: 33
sorry vbe i didn't mean to post after you, i should've refreshed the page
  #7 (permalink)  
Old 08-27-2008
gav_dhiman gav_dhiman is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 10
Hi Vbe/Elzalem,

Thanks for your response but it seems "find" word is searching entire UNIX directories rather then searching specified directory "/export/home/users".

Any suggestion on this?

Regards,
Gaurav
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 11:31 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0