The -1 is unnecessary, as ls always prints one file to a line when the destination is not a terminal.
More serious is that ls itself is not only unnecessary, but will break the script if any files are badly named with leading or trailing whitespace. You can correct that with:
The script will still fail, however, if any filenames contain spaces since you didn't quote the file variable. When dealing with filenames, always use filename expansion (globbing) rather than a command, and quote the variable, e.g.:
sir
can any body tell me how i can copy files like
copy c:\abc\pqr\mr.txt c:\windows\my documents\this.txt
i need command in linux like this
really i am a new in linux that is why simple questions
alson can any body explain me how i get current directory tree or path
in windows... (2 Replies)
Hi,
I have the below command running in unix
find /dev/data/ -name "*.*" -exec cp -R {} "/isdev/data//history" \;
This command will copy the files from /dev/data/ to /isdev/data//history and will not throw even if there is no files in source.
But if i modify the path from... (6 Replies)
scp /path/to/file <username>@<Other Server>:/path/to/newfile
If my file is named "Bob" and it is in my user "Accountant" and in a directory named "Invoice_folder"... How would this look in the above?
I can't seem to understand the logic of the above scp.
MOVING FILE FROM LOCATION #1:
/path... (1 Reply)
Hi Guys,
I am experiencing a problem right now while copying a directory as well as its subdirectories to my target directory. I know this is a very simple UNIX command using cp -R source directory target directory. but unfortunatley while doing this an error comes up on the command line saying... (2 Replies)
How can we copy a command string from a previous command line and paste it into the cursor position on the current command line? I know that ^c will not work as the shell will interpret as an interrupt signal.
Thanks, (1 Reply)
I entered the following command
find . -type f \( -newer startdate -a ! -newer enddate \) -exec cp tmp {} \;
I got the following error:
cp: 0653-436 tmp is a directory.
Specify -r or -R to copy.
What's happening here? (2 Replies)
Hi, im taking an entry Unix class, and as part of my lab assignment I have to copy all files in the /home/david/lab3 directory that have the file extension .save to your lab3/temp directory. I'm having trouble getting the grep to do anything worth while
I've been trying to do:
cp... (6 Replies)
Hello,
I have a directory in which I have files as follows
CRDT.csv
CRDT.csv.1
CRDT.csv.2
....
CRDT.csv.n
I would like to copy it over to another directory as
crdt_lon.csv
crdt_lon.csv.1
crdt_lon.csv.2
....
crdt_lon.csv.n
I am looking for a one line command but I am... (5 Replies)
Hi ,
I am trying to take a backup of file before overwriting it with cp command, I am using the command cp -b.
-rw-rw-r-- 1 autoengine murex 0 Jan 22 07:08 a
-rw-rw-r-- 1 autoengine murex 0 Jan 22 07:08 b
cp -b a b
-rw-rw-r-- 1 autoengine murex 0 Jan 22 07:08 a
-rw-rw-r-- 1... (1 Reply)