01-30-2011
Actually the "for i in.." construct works for large numbers of files and also for file names containing space characters...
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
hey guys
having some trouble figuring this out.
my program is supposed to take a name of a directory as a command line argument and change the filenames inside that directory to lowercase.
what i dont get is how you access that directory and go thru all the files and change the filenames... (1 Reply)
Discussion started by: 30177005
1 Replies
2. UNIX for Dummies Questions & Answers
i have many files with extention filename.ASN_ERROR~ at a path. I want to move these files to another path and change extension to .ASN
There are more then 80,000 files so i cant use manual commands
muneebr (5 Replies)
Discussion started by: muneebr
5 Replies
3. Shell Programming and Scripting
Dear All,
I have some thousands of files in a folder and i need to change those file names without opening the file (no need to change anything in the file content, need to change the file name only). The filenames are as follows:
Myfile_name.1_parameter
Myfile_name.2_parameter... (6 Replies)
Discussion started by: Fredrick
6 Replies
4. Shell Programming and Scripting
I have file names
m04-npt06-z30-syn.ps
m04-npt06-dp018-8x6smp.vmod
m04-npt06-sr40-syn-dp01-16x12drw.params
m04-npt06-sr40-syn-dp008-16x12drw.params
m04-npt06-sr40-syn-dp008-16x12drw.vmod
m04-npt06-sr40-syn-dp008-16x12drw.bck
m04-npt06-sr40-syn-dp008-16x12drw.exp... (6 Replies)
Discussion started by: kristinu
6 Replies
5. Shell Programming and Scripting
I have written a csh script that changes the name of file from src to dst.
I am getting the error below:
TESTAmvfiles
DONE TESTAmvfiles
set: Variable name must begin with a letter.
The csh script is:
#!/bin/csh
#... (0 Replies)
Discussion started by: kristinu
0 Replies
6. Shell Programming and Scripting
I have file names as shown and want to change the name to have only the first four numbers.
/home/chrisd/Desktop/nips/nips_2013/5212-learning-feature-selection-dependencies-in-multi-task-learning.pdf
/home/chrisd/Desktop/nips/nips_2013/5213-parametric-task-learning.pdf... (3 Replies)
Discussion started by: kristinu
3 Replies
7. Shell Programming and Scripting
I have a series of files as follows
file-1.pdf
file-2.pdf
file-3.pdf
file-4.pdf
file-5.pdf
file-6.pdf
file-7.pdf
I want to have the file names with odd numbers
starting from an initial number, for example 2000.
The result would be the following:
file-2001.pdf
file-2003.pdf... (9 Replies)
Discussion started by: kristinu
9 Replies
8. UNIX for Dummies Questions & Answers
I want to change the name of several files within a folders (directory) and subdirectories in OS X. If I only wanted to change file names within the directory I guess I would use:
rm photo*.jpg picture*.jpg
I have lots of subdirectories, is there a way of getting the file changes for all... (5 Replies)
Discussion started by: ademanuele
5 Replies
9. Debian
Hi I have a list of files :root@L28mustang:/var/log/exim4/2017/Jul2017_Blast_BC07# ls -lrt | grep mainlog
-rw-r----- 1 Debian-exim adm 3636932 Jul 8 06:25 mainlog.3.gz
-rw-r----- 1 Debian-exim adm 919512 Jul 9 06:27 mainlog.2.gz
-rw-r----- 1 Debian-exim adm 7655054 Jul 10 06:25 mainlog.1... (1 Reply)
Discussion started by: anaigini45
1 Replies
10. Shell Programming and Scripting
sac_pzs_iv_epoz_hhe__2013.074.14.40.46.0000_2599.365.23.59.59.99999
sac_pzs_iv_epoz_hhn__2013.074.14.40.46.0000_2599.365.23.59.59.99999
sac_pzs_iv_epoz_hhz__2013.074.14.40.46.0000_2599.365.23.59.59.99999
sac_pzs_iv_haga_hhe__2006.111.00.00.00.0000_2599.365.23.59.59.99999... (3 Replies)
Discussion started by: kristinu
3 Replies
SHAR(1net) Wang Institute SHAR(1net)
NAME
shar - create file storage archive for extraction by /bin/sh
SYNOPSIS
shar [-abcmsuv] [-p prefix] [-d delim] files > archive
DESCRIPTION
shar prints its input files with special command lines around them to be used by the shell, /bin/sh , to extract the files later. The out-
put can be filtered through the shell to recreate copies of the original files.
shar allows directories to be named, and shar prints the necessary commands (mkdir & cd) to create new directories and fill them. shar
will not allow existing files to be over-written; such files must be removed by the user extracting the files.
OPTIONS
-a All the options. The options: -v -c -b -p <tab>X are implied.
-b Extract files into basenames so that files with absolute path names are put into the current directory. This option has strange
effects when directories are archived.
-c Check file size on extraction by counting characters. An error message is reported to the person doing the extraction if the sizes
don't match. One reason why the sizes may not match is that shar will append a newline to complete incomplete last lines; shar
prints a message that mentions added newlines. Another reason why the sizes may not match is that some network mail programs remove
non-whitespace control characters. shar prints a message that mentions control characters to the extractor.
-d Use this as the ``end of file'' delimiter instead of the default. The only reason to change it is if you suspect a file contains
the default delimiter: SHAR_EOF.
-m Reset the exact protection modes of files when they are extracted (using the chmod program). By default, the extractor's default
file modes are used, and executable files (e.g., shell scripts) are made executable.
-p Use this as the prefix to each line of the archived files. This is to make sure that special characters at the start of lines are
not eaten up by programs like mailers. If this option is used, the files will be extracted with the stream editor sed rather than
cat so it is more efficient and portable to avoid setting the prefix, though perhaps less safe if you don't know what is in the
files.
-s Silent running. All checking and extra output is inhibited.
-u Archive the input files with the uuencode format for later extraction with uudecode. This will allow you to send files with control
characters in them, but will slow down the extracting. You must be sure that the receiving party has access to uudecode.
-v Print verbose feedback messages about what shar is doing to be printed during extraction. Sizes of plain files are echoed to allow
a simple validity check.
SEE ALSO
sh(1), tar(1), cpio(1), tp(1), uuencode(1), uudecode(1)
fpack(1) is a plain-file packer useful for UNIX and MSDOS
AUTHOR
Gary Perlman (based on a shell version by James Gosling, with additions motivated by many people on the UNIX network: Derek Zahn, Michael
Thompson, H. Morrow Long, Fred Avolio, Gran Uddeborg, Chuck Wegrzyn, nucleus!randy@TORONTO, & Bill McKeeman)
LIMITATIONS
shar does not know anything about links between files.
UNIX User's Manual March 4, 1986 SHAR(1net)