Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Check for files and move it to another directory - ksh Post 303038967 by Peasant on Wednesday 18th of September 2019 11:36:46 AM
Old 09-18-2019
Should a plain find / exec work, regardless of the shell and OS ?
Code:
DIR1=/your/source
DIR2=/your/dest
find $DIR1 -type f -name "*.[CcTt][SsXx][VvTt]" -print -exec mv {} $DIR2 \;

Test and / or reporting could be done using a report file and testing against it.
Notice the -print, which will print found files if there are any.

Regards
Peasant.
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Move all files in a directory tree to a signal directory?

Is this possible? Let me know If I need specify further on what I am trying to do- I just want to spare you the boring details of my personal file management. Thanks in advance- Brian- (2 Replies)
Discussion started by: briandanielz
2 Replies

2. Shell Programming and Scripting

How to check files and move the results to differents files?

Hi, I am a newbie to shell scripting. here is my objective: 1)The shell program should take 2 parameters - ie-> DestinationFolder, WebFolder 2)Destination folder contains few files that has to has be verified and deleted. 3)WebFolder is a folder containing a list of master files 4)It... (1 Reply)
Discussion started by: sandhyagupta
1 Replies

3. UNIX for Dummies Questions & Answers

How to move all files in a directory and subdirectory?

I'm trying to organize my MB Pro by moving all my jpeg files to a single folder from the desktop. There are some on the desktop that are not in any folder. I was at the command line and typed mv *.jpg "Jpeg files" but it only moved the files that were on the desktop, not any of the ones that... (3 Replies)
Discussion started by: Straitsfan
3 Replies

4. Shell Programming and Scripting

check for file existance and generate exit code amd move to another directory

Hi.. i have a file ABC_*.txt in source directory which will come evry 30 min and same file will be moved to working directory first time ...and will perform some operations then we archive ABC_*.txt ..this will run for 30 min to 45 min from 2nd time onwards requirement is ...i need to check... (3 Replies)
Discussion started by: dssyadav
3 Replies

5. UNIX for Dummies Questions & Answers

Zip all files in a directory and move to another directory

Hi, need to zip all files in a directory and move to another directory after the zip.. i am using this one but didnt help me... zip -r my_proj_`date +%Y%m%d%H%MS`.zip /path/my_proj mv in_proj_`date +%Y%m%d%H%M%S`.zip /path/source/ i am trying to zip all the files in my_proj... (0 Replies)
Discussion started by: dssyadav
0 Replies

6. Shell Programming and Scripting

find command to move the files to other folder - ksh 88

Hi , I've learnt that the following command will remove the files from the given folder for given no.of days find /home/etc -type f -atime -10 -exec rm -f {} \; But how can I change the above command that will move the files to another specified directory instead of removing the... (1 Reply)
Discussion started by: smile689
1 Replies

7. Shell Programming and Scripting

List files with date, create directory, move to the created directory

Hi all, i have a folder, with tons of files containing as following, on /my/folder/jobs/ some_name_2016-01-17-22-38-58_some name_0_0.zip.done some_name_2016-01-17-22-40-30_some name_0_0.zip.done some_name_2016-01-17-22-48-50_some name_0_0.zip.done and these can be lots of similar files,... (6 Replies)
Discussion started by: charli1
6 Replies

8. UNIX for Dummies Questions & Answers

How to move gz files from one source directory to destination directory?

Hi All, Daily i am doing the house keeping in one of my server and manually moving the files which were older than 90 days and moving to destination folder. using the find command . Could you please assist me how to put the automation using the shell script . ... (11 Replies)
Discussion started by: venkat918
11 Replies

9. Shell Programming and Scripting

How Create new directory and move files to that directory.?

Hi All, We have main directory called "head" under this we have several sub directories and under these directories we have sub directories. My requirement is I have to find the SQL files which are having the string "procedure" under "head" directory and sub directories as well. And create... (14 Replies)
Discussion started by: ROCK_PLSQL
14 Replies
DIFF(1) 							   User Commands							   DIFF(1)

NAME
slack-diff - compare file contents, modes, etc SYNOPSIS
slack-diff [OPTION]... FILE1 FILE2 DESCRIPTION
A wrapper for diff that displays file modes and other metadata changes. -u -U NUM --unified[=NUM] Tell diff(1) to use unified output format. --diff PROG Use this program for diffing, instead of diff. --fakediff Make a fake diff for file modes and other things that are not file contents. Default is on, can be disabled with --nofakediff. -r --recursive Recursively compare any subdirectories found. -N --new-file Treat missing files as empty. Default is on, can be disabled with --nonew-file. --unidirectional-new-file Treat only missing files in the first directory as empty. --from-file Treat arguments as a list of files from which to read filenames to compare, two lines at a time. -0 --null Use NULLs instead of newlines as the separator in --from-file mode. --devnullhack You have a version of diff that can't deal with -N when not in recursive mode, so we need to feed it /dev/null instead of the miss- ing file. Default is on, can be disabled with --nodevnullhack. --version Output version info. --help Output this help. FILES are `FILE1 FILE2' or `DIR1 DIR2' or `DIR FILE...' or `FILE... DIR'. If --from-file or --to-file is given, there are no restrictions on FILES. If a FILE is `-', read standard input. SEE ALSO
diff(1) diffutils 2.8.1 April 2002 DIFF(1)
All times are GMT -4. The time now is 05:58 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy