Sponsored Content
Full Discussion: mv : Argument list too long
Top Forums Shell Programming and Scripting mv : Argument list too long Post 302806385 by Skrynesaver on Monday 13th of May 2013 03:38:25 AM
Old 05-13-2013
If I understand you correctly, you want to move files in directory1 but not in sub directories into directory2?
Code:
for i in directory1/* ; do if [ -f $i ] ; then mv $i directory2/ ; fi;  done

This User Gave Thanks to Skrynesaver For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Argument list too long - Shell error

Trying to tar specific files from a directory causes problems when the number of files is too large. ls ~/logs | wc -l 5928 In the logs directory - I have 5928 files If I want to include all files with today's date - I run the following command tar cf ~/archive/LoadLogs_20060302.tar... (8 Replies)
Discussion started by: dad5119
8 Replies

2. UNIX for Dummies Questions & Answers

Argument list too long - SSH

Hi I executed the code for file in `ls pdb*.ent` do new_name=`echo $file | sed 's/^pdb//;s/.ent/.txt/'` mv $file $new_name done Its giving error at ' ls pdb*.ent' argument list too long i have around 150000 entries please help Thank you (6 Replies)
Discussion started by: empyrean
6 Replies

3. Shell Programming and Scripting

Argument too long list error

I have a wrote a script which consits of the below line.. Below of this script I'm getting this error "ksh: /usr/bin/ls: arg list too long" The line is log_file_time=`ssh -i $HOME/.ssh/id_rsa -q $i ls -lrt /bp/karthik/test/data/log/$abc*|tail -1|awk '{print $8}'` And $abc alias is as "p |... (1 Reply)
Discussion started by: 22karthikreddy
1 Replies

4. UNIX for Dummies Questions & Answers

Argument list too long for Sed command

Hi guys Following command results in sed -i 's/#/\\#/g' /home/test/sqlstents* -bash: /bin/sed: Argument list too long Please help me solve it.. is there any other way i can do this?.. thanks (4 Replies)
Discussion started by: depakjan
4 Replies

5. Shell Programming and Scripting

Argument list too long problem

I have a huge set of files (with extension .common) in my directory around 2 million. When I run this script on my Linux with BASH, I get /bin/awk: Argument list too long awk -F'\t' ' NR == FNR { a=NR } NR != FNR { sub(".common", "", FILENAME) print a, FILENAME, $1 } '... (1 Reply)
Discussion started by: shoaibjameel123
1 Replies

6. Shell Programming and Scripting

Argument list too long for date command

Dear Friends, The following script processes a 14508 lines log file. #!/bin/sh while read line do d=`sed 's/* - * \*\/*\/* *\)\] .*/\1/' | tr '/' ' ' | sed 's/\(*\):\(*\)/\1 \2/'` y=`date -d "${d}" "+%Y%m%d%H%M%S"` echo "${y}" done While running the above script, I am... (4 Replies)
Discussion started by: tamil.pamaran
4 Replies

7. Shell Programming and Scripting

Argument list too long!!

Dear Experts, I have a list of 10K files in a directory. I am not able to execute any commands lile ls -lrt, awk, sed, mv, etc........ I wanna execute below command and get the output. How can I achieve it?? Pls help. root# awk -F'|' '$1 == 1' file_20120710* | wc -l /bin/awk: Argument list... (2 Replies)
Discussion started by: Naga06
2 Replies

8. Shell Programming and Scripting

grep : Argument list too long

Hi, i am having some trouble with the below command, can some one suggest me the better way to do it. grep -l 'ReturnCode=1' `find $Log -newer /tmp/Failed.tmp -print | xargs ls -ld | egrep SUB | egrep -ve 'MTP' -ve 'ABC' -ve 'DEF' -ve 'JKL' -ve 'XYZ' | awk '{print $9}'` > $Home1 Its... (2 Replies)
Discussion started by: Prateek007
2 Replies

9. UNIX for Advanced & Expert Users

Argument list too long w/ sed

Hi all, I am using GNU sed (named gsed under macports) in OSX. I have a directory with a series of files named pool_01.jpg through pool_78802.jpg. I am trying to use this command to rename the files to their checksum + extension. md5sum * | gsed -e 's/\(*\) \(.*\(\..*\)\)$/mv -v \2 \1\3/e' ... (3 Replies)
Discussion started by: openthomas
3 Replies

10. Shell Programming and Scripting

Argument list too long

Hi Team, Here's the situation. I have approximately 300000 to 500000 jpg files in /appl/abcd/work_dir mv /appl/abcd/work_dir /appl/abcd/process_dir The above move command will work if the jpg files count is close to 50000 (not sure). If the count is less this mv command holds good. But if... (14 Replies)
Discussion started by: kmanivan82
14 Replies
kitcap(4)						     Kernel Interfaces Manual							 kitcap(4)

NAME
kitcap - Kit descriptor database for gentapes and gendisk utilities SYNOPSIS
Disk Media Descriptor ProdCodeHD:partition: dd=destdir[,kk=true][,rootdd=dirname]: Product_Description: kitdir[,kitdir]...:instctrl:subset[,sub- set]... [:dd=destdir[,kk=true][,rootdd=dirname]: Product_Description: kitdir[,kitdir]...:instctrl:subset[,subset]...]... Tape Media Descriptor ProdCode{MT|TK}|Product Description: directory[,directory]...:SPACE:SPACE:SPACE: INSTCTRL:subset[,subset]... [:%%N:subset[,sub- set]...]... DESCRIPTION
The kitcap file is a database for kit descriptors. This database contains product codes, media codes, and the names of the directories, files, and subsets that make up a product description used by gentapes or gendisk to create distribution media. The following rules apply to kitcap records: The first field is separated from the rest of the record by a colon (:) for disk media descriptors and by a pipe character (|) for tape media descriptors. Separate all other fields with colons (:). Indicate continuation with a backslash () at the end of the line. Lines starting with a pound sign (#) are comments and are ignored. Comments within a record start with a pound sign (#) and end with a colon (:). Use this feature sparingly. Disk Media Descriptors The following sample kitcap entry is for disk media: ProdCodeHD:partition: dd=/:Product_Description: directory1:directory2:directory3: instctrl:subset1:subset2:subset3:subset4:subset5: dd=SUB/DIR:Product_Description: directory1:directory2:directory3: instctrl:subset1:subset2:subset3:subset4:subset5 The following fields make up the kitcap descriptor for disk media: The Kit Name field consists of two concatenated subfields: the product code and the media code. This is an arbitrary alphanumeric name unique to the product. Typical codes include a product identifier and a version identifier, as shown in the EXAMPLES section. For example, if the product name is MYPRODUCT and the version is 1.0, the product- code might be MYPRODUCT100. The media code for disks is HD. This field specifies the partition where the software will be written on the media by the gendisk utility. Valid values are a through h. The usual value is c, as it spans the entire disk. This field specifies the directory in which to write the subsets on the disk media being created. The contraction dd can be thought of as the destination directory for the subsets. This field is required and allows a hierarchical structure so that you can put multiple products on the same disk or place parts of one product into different areas on the disk. Typically, a disk is mounted by the gendisk utility to a temporary mount point under /usr/tmp. This location becomes the disk's root directory. To specify only one directory for an entire product, a valid entry would be dd=/. This entry tells the gendisk utility to write all the following subsets under the mount point. You also may use the following parameters in the dd field: This parameter can be used for kernel product kits and hardware product kits, and indicates that the kit is needed during the boot process. When the gendisk utility finds this parameter, it automatically generates a kitname.kk file. This parameter specifies kit placement on the distribution media, relative to the kit-specific direc- tory such as OAT100/kit. For example, rootdd=.. would place the kit's root under the OAT100 directory on the distribution media. In the disk kitcap descriptor example shown in the EXAMPLES section, the first five subsets are written to the mount point, or root directory, for the disk media being made. Then a new directory, /mnt_point/SUB/DIR, is created on the disk media and the next five subsets are written into that directory. It is important to note that the top-level directory of the media disk is always considered the mount point used by the gendisk script and is referenced by dd=/. Any subdirectories listed as destination directories are created starting from the mount point and must be referenced in full. For instance, to put some other subsets in a subdirectory of DIR in the previous example, the entry would be dd=SUB/DIR/SUBSUBDIR. Each new destination directory requires a product description. This field is similar to the optional product description for magnetic tape, but for disk media the product description is a required field. All words in the description must be connected with underscores (_). The gendisk script removes the underscores at run time. For example, to create the description for "This is a good product", the Product Description entry for disk media would be: This_is_a_good_product One or more product source directories. The gendisk utility can produce a multiproduct disk with subsets from different products, based in different directories, and merge them on the disk to form a combined product. Directory entries provide the full path locations for the subsets to be put on the media. There must be at least one directory entry for each kitcap descriptor. The instctrl directory contains setld control information. This is analogous to the INSTCTRL file for magnetic tape. The subset fields provide a list of subsets or files to be either written to the disk media or verified from the disk media. Each subset listed must be stored in one of the directories listed in the kitcap descriptor. If a file or subset is stored in a subdirectory of one of the directories listed in the kitcap descriptor, it is possible to include that subpath with the subset or file name entry instead of listing the entire path or subpath as another directory listing. For example, a directory listed in the kitcap descriptor under the rules given in the directoryN section is listed as: /KITS/MYPRODUCT/001 A particular subset or file to be included on the media is stored in: /KITS/MYPRODUCT/001/subdirectory/subset Since the subdirectory/subset specification is part of the /KITS/MYPRODUCT/001 directory tree, it is not necessary to include the full path of the /KITS/MYPRODUCT/001/ subdirectory in the directory listing. Alterna- tively, you could include the subdirectory path with the subset name in the subset list. For example: MY-PROD-001HD:c: dd=/KITS/MYPRODUCT/001:This_is_a_good_product: instctrl:subset1:subset2: subdirectory/subset3: subset4 Magnetic Tape Media Descriptors The following kitcap entry examples are for TK50 and MT9 media types, respectively: ProdCodeTK|Product Description:directory1:directory2: directory3:SPACE:SPACE:SPACE:INSTCTRL:subset1:subset2: subset3:subset4:subset5 ProdCodeMT|Product Description:directory1:directory2: directory3:SPACE:SPACE:SPACE:INSTCTRL:subset1:subset2: subset3:subset4:subset5:%%2:subset6:subset7:subset8: subset9:subset10 The following fields make up the kitcap descriptor for magnetic tape media: The Kit Name field consists of two concatenated subfields: the product code and the media code. For tape media, it is separated from the rest of the record by a pipe character (|). This is an arbi- trary alphanumeric name unique to the product, including both product and version identifiers as shown in the EXAMPLES section. For exam- ple, if the product name is MYPRODUCT Version 1.0, the product-code might be MYPRODUCT100. The media code is a 2-letter reference specify- ing the type of media to be used. This must be either TK for TK50 or MT for 9-track magnetic tape devices. This field is a description of the software product to be created by the gentapes utility. It replaces the NAME field in the control file (filename.ctrl) for each of the subsets that make up a product. This field is optional for magnetic tape media. The gentapes utility can produce multiproduct tapes. That is, it can take subsets from different products, based in different directories, and merge them on the tape to form a combined prod- uct. Directory entries provide the full path locations for the subsets to be put on the media. There must be at least one directory entry for each kitcap descriptor. The SPACE file is a placeholder for tape records, and contains 10Kb of NULL characters. Three SPACE files are used as dummy files to ensure compatibility with operating system kits. The INSTCTRL image contains setld control information. The subset fields provide a list of subsets or files to be either written to the magnetic tape media or verified from the magnetic tape media. Each subset listed must be stored in one of the directories listed in the kitcap descriptor. If a file or subset is stored in a subdirectory of one of the directories listed in the kitcap descriptor, you can include that subpath with the subset or file name entry instead of listing the entire path or subpath as another directory listing. For example, a directory listed in the kitcap descriptor under the rules given in the directoryN section is listed as: /KITS/MYPRODUCT/001 A particular subset or file to be included on the media is stored in: /KITS/MYPRODUCT/001/subdirectory/subset Since the subdirectory/subset specification is part of the /KITS/MYPRODUCT/001 directory tree, it is not necessary to include the full path of the /KITS/MYPRODUCT/001/ subdirectory in the directory listing. Alternatively, you could include the subdirectory path with the subset name in the subset list. For example: MY-PROD-001MT|This is a good product: /KITS/MYPRODUCT/001:SPACE:SPACE:SPACE: INSTCTRL:subset1:subset2: subdirectory/subset3:subset4 The volume identifier is optional. Multitape support is provided for products that have subsets or files that require more space than is available on a single 9-track magnetic tape. If the subset list results in an end-of-tape condition, the subset list can be split into any number of multivolume sets by placing %%n anywhere appropriate in the subset list (where n is the volume number of the next tape). The subsets listed between the volume identifiers must fit on a single piece of media. By default, the subset list located directly after the directory list is always considered the first volume. Therefore, a volume identifier is not necessary for the first volume in a multivolume kit descriptor. EXAMPLES
Disk Description (Multiple Products): MYPRODUCT400HD:c: dd=MYPRODUCT/BASE: MYPRODUCT_software_version_4_base_subsets: /directory1:/directory2:/directory3: instctrl:subset1:subset2:subset3:subset4:subset5: dd=MYPRODUCT/NONBASE: MYPRODUCT_software_version_4_nonbase_subsets: /directory1:/directory2:/directory3: instctrl:subset1:subset2:subset3:subset4:subset5 TK50 Description (Single-Volume Tape) MYPRODUCT400TK|MYPRODUCT software version 4: :# directory listing : /directory1:/directory2:/directory3: SPACE:SPACE:SPACE:INSTCTRL: :# subset listing : subset1:subset2:subset3:subset4:subset5 MT9 Description (Multivolume Tape): MYPRODUCT400MT|MYPRODUCT software version 4: /directory1:/directory2:/directory3: SPACE:SPACE:SPACE:INSTCTRL: subset1:subset2:subset3:subset4:subset5: :# Volume 2 :%%2: subset6:subset7:subset8:subset9:subset10 Disk Description (Single Product): MYPRODUCT400HD:c: dd=/:MYPRODUCT_software_version_4: /directory1:/directory2:/directory3: instctrl:subset1:subset2:subset3:subset4:subset5 RELATED INFORMATION
gendisk(1), gentapes(1) Guide to Preparing Product Kits delim off kitcap(4)
All times are GMT -4. The time now is 03:43 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy