Sponsored Content
Top Forums Shell Programming and Scripting Shell script to copy files from on folder to another Post 302962467 by Don Cragun on Tuesday 15th of December 2015 01:56:39 AM
Old 12-15-2015
Please tell us in English what files you want to move from what file hierarchy and to what directory.

What you have said so far seems to be saying that you want to find regular files modified within the last 24 hours with names starting with 12 and ending with .csv where those files are found in the file hierarchy rooted in the current directory (or maybe in the file hierarchy rooted in $srcdir or maybe in the file hierarchy rooted in $source) and make a copy of the files that meet that criteria to the directory named by $dstdir (or maybe by $destination or some other directory).
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script to find out 2 last modified files in a folder..PLZ HELP!!!!!!!!!

hi all, I need to find out the last 2 modified files in a folder.There is some way by which,we can check the timestamp and find out..??please help this is urgent. Thanks in Advance Anju (3 Replies)
Discussion started by: anju
3 Replies

2. UNIX for Advanced & Expert Users

Auto copy for files from folder to folder upon instant writing

Hello all, I'm trying to accomplish that if a file gets written to folder /path/to/a/ it gets automatically copied into /path/to/b/ the moment its get written. I thought of writing a shell script and cron it that every X amount of minutes it copies these files over but this will not help me... (2 Replies)
Discussion started by: Bashar
2 Replies

3. Shell Programming and Scripting

HOW TO CHECK ONLY .C FILES EXISTS OR NOT IN A FOLDER using IF in C shell script?

Hi friends.. I hav a problem.... I dont know how to check .c files exists r not in a folder using IF in C shell script actually i tried like this if(=~ *.c) even though some .c files or there in the current folder..it is not entering int o the if control statement...... (17 Replies)
Discussion started by: p.hemadrireddy
17 Replies

4. Shell Programming and Scripting

Find all text files in folder and then copy to a new folder

Hi all, *I use Uwin and Cygwin emulator. I´m trying to search for all text files in the current folder (C/Files) and its sub folders using find -depth -name "*.txt" The above command worked for me, but now I would like to copy all found text files to a new folder (C/Files/Text) with ... (4 Replies)
Discussion started by: cgkmal
4 Replies

5. Shell Programming and Scripting

How to Process input files from folder in shell script?

Hi, I want to process all input files available into folder (C:\ShellPrg\InputFile\) Input files are abc.CSV , XYZ.zip (zip of CSV file), PQR.gz (zip of CSV file). I want to check the extension of file, If its .zip/.gz then need to unzip the file as .CSV I want to parse line by line of... (2 Replies)
Discussion started by: Poonamol
2 Replies

6. Shell Programming and Scripting

How to unzip files from folder in shell script (ksh)?

I have a folder (C:\shellprg\input\) containing .CSV, .zip, .gz files. 1] I want to find all .zip/.gz files from folder (C:\shellprg\input\). 2] unzip/uncompress files into the same folder (C:\shellprg\input\) through shell script. I am using below commands for unzip files, unzip <filename>... (2 Replies)
Discussion started by: Poonamol
2 Replies

7. Shell Programming and Scripting

Shell script that lists files with different owner than the folder

Hello, I'm trying to write a script which is listing files based on different preferences, like filetype or permissions. All is fine, except for one: I want to list files in /home which has a different owner than the home directory it is in. Here is an example: /home/UserA is the directory, and... (10 Replies)
Discussion started by: Zwiebi
10 Replies

8. Shell Programming and Scripting

How to copy files with the same filenames as those in another folder to that same folder?

Hello All A similar question like this was asked before but I need to change part of the question. I've two folders, Folder A contains some image files in 150 subfolders; Folder B contains text files in 350 subfolders. All image files in Folder A have the same filename as the text... (5 Replies)
Discussion started by: chlade
5 Replies

9. Shell Programming and Scripting

Shell script which will check the target file and folder exists and copy it

Hi All, I am a beginner in this and trying to write a shell script in linux which will : 1. Ask for a file name and check if its exists. 2. If file exists only then it will ask for the new target folder, after entering target folder name it will check if it exists. 3. If target folder... (3 Replies)
Discussion started by: ashish_neekhra
3 Replies

10. Shell Programming and Scripting

Request for Shell script to move files from Subfolder to Parent folder and delete sub folder

Hi Team, I am new to shell script and there is a requirement where files should be moved from Subfolder to parent folder. Eg: parent folder --> /Interface/data/test/IN Sub folder -->/Interface/data/test/IN/Invoice20180607233338 Subfolder will be always with timestamp... (6 Replies)
Discussion started by: srivarun15
6 Replies
du(1)								   User Commands							     du(1)

NAME
du - summarize disk usage SYNOPSIS
/usr/bin/du [-adr] [-k | -h] [-H | -L] [-o | -s] [file ...] /usr/xpg4/bin/du [-a | -s] [-k | -h] [-H | -L] [-rx] [file ...] DESCRIPTION
The du utility writes to standard output the size of the file space allocated to, and the size of the file space allocated to each subdi- rectory of, the file hierarchy rooted in each of the specified files. The size of the file space allocated to a file of type directory is defined as the sum total of space allocated to all files in the file hierarchy rooted in the directory plus the space allocated to the directory itself. This sum will include the space allocated to any extended attributes encountered. Files with multiple links will be counted and written for only one entry. The directory entry that is selected in the report is unspeci- fied. By default, file sizes are written in 512-byte units, rounded up to the next 512-byte unit. /usr/xpg4/bin/du When du cannot obtain file attributes or read directories (see stat(2)), it will report an error condition and the final exit status will be affected. OPTIONS
The following options are supported for /usr/bin/du and /usr/xpg4/bin/du: -a In addition to the default output, report the size of each file not of type directory in the file hierarchy rooted in the speci- fied file. Regardless of the presence of the -a option, non-directories given as file operands will always be listed. -h All sizes are scaled to a human readable format, for example, 14K, 234M, 2.7G, or 3.0T. Scaling is done by repetitively dividing by 1024. -H If a symbolic link to a directory is specified on the command line, process the symbolic link by using the directory which the symbolic link references, rather than the link itself. -k Write the files sizes in units of 1024 bytes, rather than the default 512-byte units. -L Process symbolic links by using the file or directory which the symbolic link references, rather than the link itself. -s Instead of the default output, report only the total sum for each of the specified files. Specifying more than one of the options in the mutually exclusive pair, -H and -L, is not considered an error. The last option specified determines the output format. /usr/bin/du The following options are supported for /usr/bin/du only: -d Do not cross filesystem boundaries. For example, du -d / reports usage only on the root partition. -o Do not add child directories' usage to a parent's total. Without this option, the usage listed for a particular directory is the space taken by the files in that directory, as well as the files in all directories beneath it. This option does nothing if -s is used. -r Generate messages about directories that cannot be read, files that cannot be opened, and so forth, rather than being silent (the default). /usr/xpg4/bin/du The following options are supported for /usr/xpg4/bin/du only: -r By default, generate messages about directories that cannot be read, files that cannot be opened, and so forth. -x When evaluating file sizes, evaluate only those files that have the same device as the file specified by the file operand. OPERANDS
The following operand is supported: file The path name of a file whose size is to be written. If no file is specified, the current directory is used. OUTPUT
The output from du consists of the amount of the space allocated to a file and the name of the file. USAGE
See largefile(5) for the description of the behavior of du when encountering files greater than or equal to 2 Gbyte ( 2**31 bytes). ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables that affect the execution of du: LANG, LC_ALL, LC_CTYPE, LC_MES- SAGES, and NLSPATH. EXIT STATUS
The following exit values are returned: 0 Successful completion. >0 An error occurred. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: /usr/bin/du +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ |CSI |Enabled | +-----------------------------+-----------------------------+ |Interface Stability |Stable | +-----------------------------+-----------------------------+ /usr/xpg4/bin/du +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWxcu4 | +-----------------------------+-----------------------------+ |CSI |Enabled | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ SEE ALSO
ls(1), stat(2), attributes(5), environ(5), fsattr(5), largefile(5), standards(5) System Administration Guide: Basic Administration NOTES
A file with two or more links is counted only once. If, however, there are links between files in different directories where the directo- ries are on separate branches of the file system hierarchy, du will count the excess files more than once. Files containing holes will result in an incorrect block count. SunOS 5.10 5 Oct 2003 du(1)
All times are GMT -4. The time now is 01:50 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy