You didn't do anything wrong exactly, but there were just too many filenames to cram into one cp call. Handling that many filenames gets a bit more complicated. Too many arguments is too many arguments -- ls kl* or any other variations like that won't work either. You'll need to print a full listing with ls, filter what you want with grep, and read in a loop. Put them through a stream so we can read them one at a time in other words, instead of trying to cram them all into one line.
Notice how grep takes a different kind of expression than you'd do in the shell. It doesn't match the entire line, it can match part of the line anywhere, so we have to stick a ^ in the front to tell it "only look for kl at the beginning of the line". And we don't have to match the rest of it since knowing it has a 'kl' in front is good enough.
Then we read lines one by one and feed them into cp one by one. Remove the 'echo' once you've tested it and are sure it does what you want.
Hi all,
Would like to rename all files using wildcards - if at all possible!
As an example I have the following files:
Nov01_df
Nov02_df
Nov03_df
......
Nov28_df
Nov29_df
Nov30_df
I'd like to have these renamed as "df??" where ?? is the number from the original file name.
Any... (5 Replies)
How do I use cat (presumably with a sh script) to combine all the files in a directory without listing them individually.
Thank you for your patience with this very elementary question.:) (3 Replies)
hi
I want to copy all files from the current directory and move to .archive file.
Moreover,I want to add .bak to each file name, that will be copied.
How can I do that? (4 Replies)
I am userB and have a dir
/temp1
This dir is owned by me.
How do I recursively copy files from another users's dir userA?
I need to preserve the original user who created files, original group information, original create date, mod date etc.
I tried
cp -pr /home/userA/* .
... (2 Replies)
Hi All
I am having hundred over file in the below pattern.
AA050101.INI
BB090101.INI
.
.
ZX980101.INI
Need to rename these files with an extension .bak
AA050101.INI.bak
BB090101.INI.bak
.
.
ZX980101.INI.bak (5 Replies)
I have a question regarding Perl scripting.
If I want to say open files that all look like this and assign them to a filehandle and then assign the filehandle to a variable, how do I do this?
The file names are
strand1.fa.gz.tmp
strand2.fa.gz.tmp
strand3.fa.gz.tmp
strand4.fa.gz.tmp
...... (6 Replies)
Hi All,
I'm trying to list some files from my log directory
and files are like this
log.20110302_20.gz
log.20110302_21.gz
log.20110302_22.gz
log.20110302_23.gz
log.20110303_00.gz
log.20110303_01.gz
log.20110303_02.gz
............
log.20110311_22.gz
log.20110311_23.gz... (2 Replies)
Hi All,
I am doing this for svn patch making. I got the list of files to make the patch. I have the list in a file with path of all the files.
To Do
From Directory : /myproject/MainDir
To Directory : /myproject/data
List of files need to copy is in the file: /myproject/filesList.txt
... (4 Replies)
All,
I need to grab and rename common files from several unique directory structures. For example, the directory structures looks like:
/unique_dir/common/common/common/person_name_dir/common_file.txt
There are over 90,000 of these text files that I'd like to put in a single directory as... (5 Replies)
I'm trying to do this exact same thing, so far I have created this to move files
i've named my script CP.sh
#!/bin/bash
cd /root/my-documents/NewDir/
for f in *.doc
do cp -v $f root/my-documents/NewDir $f{%.doc}
done
When i go to run this in the console i type, bin/sh/ CP.sh
but it... (7 Replies)
Discussion started by: MKTM_93_SIMP
7 Replies
LEARN ABOUT OSF1
mread
mread(1) General Commands Manual mread(1)NAME
mread - mtools utility to perform a low level read (copy) of a DOS file to UNIX
SYNOPSIS
mread [-tnm] msdosfile unixfile
mread [-tnm] msdosfile [msdosfiles...] unixdirectory
OPTIONS
Preserves the file modification time. Specifies that a warning is not issued when an existing file is specified as the target file. If
this option is not specified, the mread command verifies whether or not to overwrite an existing file. Specifies a text file transfer.
Line terminators are converted to the appropriate format.
DESCRIPTION
The mread command copies the specified DOS file to the named UNIX file, or copies multiple DOS files to the named UNIX directory.
DOS subdirectory names that contain the '/' or '' separator are supported. If you use the '' separator or wildcards, you must enclose
file names in quotes to protect them from the shell.
The mcd command can be used to establish the device and the current working directory (relative to DOS), otherwise the default is A:.
RESTRICTIONS
Unlike DOS convention, the destination directory may not be omitted.
EXIT STATUS
The following exit values are returned: Success. Failure.
ENVIRONMENT VARIABLES
The following environment variables affect the execution of mread: If set, this variable names the file that contains the name of the cur-
rent mtools working directory as established by the mcd command. If this variable is not set, the file $HOME/.mcwd is used.
FILES
Contains the name of the current mtools working directory as established by the mcd command. If this file does not exist, the default
mtools working directory is A:. Executable file
SEE ALSO
Commands: dos2unix(1), mcd(1), mcopy(1), mdiskcopy(1), mtools(1), mtype(1), mwrite(1), unix2dos(1)mread(1)