Visit Our UNIX and Linux User Community


How to copy files to one folder?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How to copy files to one folder?
# 1  
Old 07-19-2011
How to copy files to one folder?

Hi ,

I have a file like this, i need to trace its path and copy the files from its path to one folder. I need to replace elib.com,melib.com to F:\.Here i need to copy to a folder called image. Please help

http://elib.com/SHC/NLNLHB/020001498.pdf http://elib.com/SHC/NLHB/020002218.pdf http://elib.com/SHC/NLHB/020002217.pdf http://elib.com/SHC/NLHB/020000920.pdf http://elib.com/SHC/NLHB/020002083.pdf melib :: your personal media library melib :: your personal media library melib :: your personal media library melib :: your personal media library melib :: your personal media library
Thanks a lot for your time
# 2  
Old 07-19-2011
Code:
 
nawk '{for(i=1;i<=NF;i++){printf("%s\n",$i)}}' filename | sed 's/.*com//' | nawk '/pdf/ {printf("F:%s\n",$0)}'

# 3  
Old 07-19-2011
Hi,

This is only copying the file names i need to copy the files too. Please suggest

Thanks a lot
# 4  
Old 07-19-2011
Code:
nawk '{for(i=1;i<=NF;i++){printf("%s\n",$i)}}' filename | sed 's/.*com//' | nawk '/pdf/ {printf("F:%s\n",$0)}' | while read line; do mv $line /images/; done

# 5  
Old 07-20-2011
Hi,

Thanks i am not able to use nawk, it says cannot find the command , can i replace the word with any other keyword pls let know

Thanks a lot

---------- Post updated at 04:29 PM ---------- Previous update was at 04:15 PM ----------

also getting mv target /images/ is not a directory

---------- Post updated at 06:30 PM ---------- Previous update was at 04:29 PM ----------

Please help ,

My path is also having some space inbetween , how to ignore and copy the files from the path to a given folder. Kindly help
http://elib.com/SHC/SP%20Pages/SP%20...06460_0001.jpg http://elib.com/SHC/SP%20Pages/SP%20...06462_0001.jpg http://elib.com/SHC/SP%20Pages/SP%20...06463_0001.jpg http://elib.com/SHC/SP%20Pages/SP%20...06464_0001.jpg http://elib.com/SHC/SSP%20Pages/SP%2...06468_0001.jpg http://elib.com/SHC/SP%20Pages/SP%20...06469_0001.jpg
Thanks ,
Waiting for your reply

---------- Post updated 07-20-11 at 11:27 AM ---------- Previous update was 07-19-11 at 06:30 PM ----------

Hi,

Hi,

Thanks i am not able to use nawk, it says cannot find the command , can i replace the word with any other keyword pls let know

Thanks a lot

---------- Post updated at 04:29 PM ---------- Previous update was at 04:15 PM ----------

also getting mv target /images/ is not a directory

---------- Post updated at 06:30 PM ---------- Previous update was at 04:29 PM ----------

Please help ,
I am in an urgent need, Please help
My path is also having some space inbetween , how to ignore and copy the files from the path to a given folder. Kindly help
http://elib.com/SHC/SP%20Pages/SP%20...06460_0001.jpg http://elib.com/SHC/SP%20Pages/SP%20...06462_0001.jpg http://elib.com/SHC/SP%20Pages/SP%20...06463_0001.jpg http://elib.com/SHC/SP%20Pages/SP%20...06464_0001.jpg http://elib.com/SHC/SSP%20Pages/SP%2...06468_0001.jpg http://elib.com/SHC/SP%20Pages/SP%20...06469_0001.jpg
Thanks ,
Waiting for your reply
 

Previous Thread | Next Thread
Test Your Knowledge in Computers #75
Difficulty: Easy
Apple's Mac OS X was based on NeXTStep, but iOS was not based on Mac OS X.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to copy files with the same filenames as those in another folder to that same folder?

Hello All A similar question like this was asked before but I need to change part of the question. I've two folders, Folder A contains some image files in 150 subfolders; Folder B contains text files in 350 subfolders. All image files in Folder A have the same filename as the text... (5 Replies)
Discussion started by: chlade
5 Replies

2. UNIX for Dummies Questions & Answers

Copy files to folder.

Hi, I have a folder which contains some files like this. bin.000001 bin.000002 bin.000003 bin.000004 bin.000005 bin.000129 bin.index I want to copy all these files to a new folder except the last files. Please provide some ideas. Please use next time code tags for your code... (6 Replies)
Discussion started by: arijitsaha
6 Replies

3. Shell Programming and Scripting

Problem in copy files to a folder

Hi all, cp -r /tmp/Agent/* /apps/opt/Agent/TEST When I copy files under /tmp/Agent using this command Files are getting copied to Agent folder also but I need only in the TEST folder. Is there any way to fix this issue??\ Thanks in advance Ananth (4 Replies)
Discussion started by: Ananthdoss
4 Replies

4. Shell Programming and Scripting

Copy files from one folder to another with rule

Hello! Please, help me to find or write this simple bash-script. I have first folder /tmp/work/folder1 with such files: name1.txt name2.txt.1 name2.txt.2 name3.txt name4.txt name4.txt.1 name4.txt.2 name4.txt.3 etc.. I need to copy all files from folder1 to folder... (1 Reply)
Discussion started by: optik77
1 Replies

5. Shell Programming and Scripting

Copy all zipped files from one folder to another

Hi everyone, when I try to copy *.gz files run cp within the correct source folder it works as follow: Source folder = C:/Documents and Settings/user/Recent papers/2771/ Destination folder = C:/Documents and Settings/user/My documents/1532/temp cp *.gz "C:/Documents and Settings/user/My... (2 Replies)
Discussion started by: cgkmal
2 Replies

6. Shell Programming and Scripting

copy all files with the same filenames as those in another folder

Hi, all: I've got two folders, folder A contains some image files (say, 100 files) in .jpg format; folder B contains all description files (say, 500 files) in .txt format. All image files in folder A are able to find their corresponding description files in folder B. That is to say,... (3 Replies)
Discussion started by: jiapei100
3 Replies

7. Shell Programming and Scripting

Copy files from folder and rename them

hello, I need to build a shell script that receives the folder to copy by parameter and copy all files except thumb.db to another folder and rename them like, file.jpg renamed to file_bb1.jpg. can someone help me Thanks (4 Replies)
Discussion started by: zeker
4 Replies

8. Shell Programming and Scripting

Find all text files in folder and then copy to a new folder

Hi all, *I use Uwin and Cygwin emulator. Im trying to search for all text files in the current folder (C/Files) and its sub folders using find -depth -name "*.txt" The above command worked for me, but now I would like to copy all found text files to a new folder (C/Files/Text) with ... (4 Replies)
Discussion started by: cgkmal
4 Replies

9. UNIX for Advanced & Expert Users

Auto copy for files from folder to folder upon instant writing

Hello all, I'm trying to accomplish that if a file gets written to folder /path/to/a/ it gets automatically copied into /path/to/b/ the moment its get written. I thought of writing a shell script and cron it that every X amount of minutes it copies these files over but this will not help me... (2 Replies)
Discussion started by: Bashar
2 Replies

10. Shell Programming and Scripting

How to copy one folder to another with existing files

For example, /tmp/folder1 includes /tmp/folder1/a /tmp/folder1/b /tmp/folder2 includes /tmp/c Is there a command without removing files in /tmp/folder2 first to copy the /tmp/folder1 to /tmp/folder2? and the result should be /tmp/folder2 will include only /tmp/folder2/a... (2 Replies)
Discussion started by: lalelle
2 Replies

Featured Tech Videos