Sponsored Content
Top Forums Shell Programming and Scripting copying files with spaces in the filename Post 302337454 by lathavim on Friday 24th of July 2009 07:20:16 AM
Old 07-24-2009
You can try with loop.


Code:
 
ls *rft | head -20 >tmp
while read file
do
cp "$file" ./chk
done<tmp

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

moving files with spaces in filename from one directory to another

Hello, When I run following script #!/bin/bash cd ~/directory1 mv `ls -trF | grep -v / | tail -10 ` ~/directory2 works fine with filenames not having any space but runs into issues with filenames that have spaces tried with $file variable still doesnot work. Can someone help me (4 Replies)
Discussion started by: asakhare
4 Replies

2. Shell Programming and Scripting

List files with spaces in filename

I have a text file containing files in a directory structure i.e. /project/hr/raw/jcpdatav/datav_aug03 /project/hr/raw/jcpdatav/comb8121sep02n /project/hr/raw/jcpdatav/datav_feb04_ons /project/hr/raw/jcpdatav/corpsick_jun06 /project/hr/raw/jcpdatav/jcpjoiners200507... (3 Replies)
Discussion started by: mr_crosby
3 Replies

3. Shell Programming and Scripting

Removing spaces within Filename

Hello, I have a Folder (myfile) which contain the following files: P$12789865KR +N+01+OM+16102009165416.nu P$M1-508962GD +N+01+ALP+14102009094417.nu Is there a sed command(s) that will loop through this folder and remove the spaces that exists in the filename? Any help would be... (7 Replies)
Discussion started by: Fishn
7 Replies

4. Shell Programming and Scripting

spaces in filename

Hello I canīt find an answer to my problem. I am trying to tar some files with spaces #!/bin/sh files="/var/installer/server Config /var/installer/client user /var/installer/Svenskt Language /var/installer/GUI user Plugin /var/installer/Firefox Plugin" tar -czvf /tmp/files.tar.gz... (14 Replies)
Discussion started by: Lusen
14 Replies

5. Shell Programming and Scripting

Copying files using $filename

Hi, I've a problem. Here is the code: #!/bin/ksh echo "enter a file name" read a cd /home/linux1/sam if then echo "file exists" cp $a $a_bkp else echo "file doesn't exist" fi when executed the o/p is: enter a file name contact file exists cp: missing destination file (4 Replies)
Discussion started by: sam_bd
4 Replies

6. UNIX for Dummies Questions & Answers

Copying files with spaces in the filename in a for loop

Hi all, I've been tangoing with this one for a couple of days now and I'm still not making any progress. Basically I'm trying to match three numbers in a string from a text file with matching numbers in a jpeg, and then copying the results to another folder. Data looks like this: Model:... (4 Replies)
Discussion started by: faceonline
4 Replies

7. Shell Programming and Scripting

Rename all files (filename with spaces) to different extension

Hi, I have files with filenames as below. SGM Daily Sales Email-en-us-05312012.xlwa I want to rename it in .xls. I am writing a script to change this, as there can be multiple files in subfolders. I have the following script. #!/bin/ksh for oldfile in $(find... (1 Reply)
Discussion started by: mac4rfree
1 Replies

8. Solaris

While copying files from windows to Solaris5.8 with filezilla length of the filename changed

Hello I am copying a tar from windows7 to Solaris with filezilla i could see, some characters in the name of the file get deleted. I could see only substring of the filename eg: original filename :abcdefghijklmnopqrstu.h i can see like abcdefghijklm solution to this problem is highly... (2 Replies)
Discussion started by: Revathi R
2 Replies

9. Shell Programming and Scripting

Creating Multiple data files with spaces in the filename

Hi, I have a list of filenames in the format with Spaces in the filename. As an example : Sample File 1.txt Sample File 2.txt Sample File 3.txt.....I have about 100 files like this. I am trying to create a block of code or use an available command to a) Create a file b) Put in some... (2 Replies)
Discussion started by: ban3rj33
2 Replies

10. Shell Programming and Scripting

Remove spaces in filename

Hi team, Here's a requirement for me. Here are the list of files i have in a unix directory. W 2 A D_2014.csv W 3 A D_2014.csv W 4 A D_2014.csv /home/kmani00-> uname -a AIX sliyyvxx 1 6 00F613E54C00 /home/kmani00-> The file names has to be without spaces as follows. W2AD_2014.csv... (1 Reply)
Discussion started by: kmanivan82
1 Replies
INSTALL(1)						      General Commands Manual							INSTALL(1)

NAME
install - install files SYNOPSIS
install [-lcszN] [-o owner] [-g group] [-m mode] [-S stack] [file1] file2 install [-lcszN] [-o owner] [-g group] [-m mode] [-S stack] file ... dir install -d [-o owner] [-g group] [-m mode] directory DESCRIPTION
Install puts executables, manual pages, and library files in their proper place in the bin, man, and lib directories. The first two forms of the command are like cp(1) copying either one file to another or copying several files to a directory. The "-d" form is like mkdir(1) with the -p flag. File1 may be omitted if neither -l nor -c is given to change the attributes of file2. Attributes are always copied from the source file, use the options to change. Note that the source file's attributes are changed with the destination file if they are linked. So copy the file if you change it in a way that makes it read-only. You would otherwise not be able to compile a command again. OPTIONS
-l Link the destination to the source file instead of copying it. This is done to either save space on a file system with both the source and the bin directories on it, or to install synonyms to a command. -c Copy the source file to its proper place. This option is the default if -l is not given. With -l, the file is copied if the link fails. -s Strip the destination file of its symbol table, if it is an executable, and if it is actually copied. It has no effect on a link or a non-executable. -z Compress the executable using compress(1) and prepend a header line that calls zexec(1) to decompress and execute the binary. This will on average save 40% disk space at the expense of a slower startup time. Like -s the file must be actually copied for the flag to have effect. -N Use gzip -N to compress the binary. You may see up to 60% space savings, but it will take much longer. N is a digit from 1 to 9 telling the compression effort, see gzip(1). -d Make a directory, usually to install files in a separate directory in a library. Intermediate directories in the path are created with the same attributes as the final directory. Only the attributes of the final directory are set if the directory exists. -o owner Set the owner of the target. This only works if the invoker is the super-user, or if install is run setuid root and the invoker is a member of group zero. If -o is omitted then the ownership is copied from the source file, or set to the id of the invoker if a directory is made. -g group Like -o, but for the group ownership of the target. -m mode Mode is an octal number that specifies the mode the target should get. The default is the source file's mode with a chmod a+rX applied to it, or 755 for a new directory. Implies -o 0, or -g 0 if a file is to be set-uid or set-gid and the invoker has permis- sion to change ownership. This trick allows a group 0 member to install third party software, even though it expects to be installed by root. -S stack Sets the maximum amount of heap + stack that an executable may have when running. The argument is a C-style decimal, octal or hexa- decimal number, optionally followed by the multipliers m, k, w, and b for mega (1024*1024), kilo (1024), "word" (2 or 4), and byte (1). Uppercase M is also accepted for those who know what S.I. means. The compilers use -S 32kw by default, that translates to 64kb for an 8086, and 128kb for other architectures. This option is ignored on a non-executable. SEE ALSO
ln(1), cp(1), strip(1), compress(1), gzip(1), zexec(1), chown(8), chgrp(8), chmod(1), chmem(1), mkdir(1). BUGS
Uppercase K, W, and B are also accepted for those who don't know what S.I. means. AUTHOR
Kees J. Bot (kjb@cs.vu.nl) INSTALL(1)
All times are GMT -4. The time now is 06:25 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy