Sponsored Content
Full Discussion: moving file
Top Forums Shell Programming and Scripting moving file Post 302570894 by Corona688 on Friday 4th of November 2011 03:12:08 PM
Old 11-04-2011
Code:
while true
do
        sleep 60

        DATE=$(date +%Y-%m-%d)

        # Creates dir only if it doesn't already exist
        mkdir -p /garbage/${DATE}/

        find ./ '(' -name '*.php' -o -name '*.css' -o -name '*.html' ')' -exec mv '{}' /garbage/${DATE}/ ';' -print > /tmp/$$

        if [ -s /tmp/$$ ]
        then
                echo "Files moved on $(date)"
                cat /tmp/$$
        fi >> /path/to/logfile

        rm -f /tmp/$$
done

This User Gave Thanks to Corona688 For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

moving or removing a file

Hi, Happy 2002. Now I am actually encountering a problem. Suppose I have a file which I can see has been named as -rw-rwx or .rwxrw-- . when I try to move this file I am unable to do so. Can someone please help me , How can i get rid of the file. Thanks in advance . :confused: (3 Replies)
Discussion started by: rooh
3 Replies

2. UNIX for Dummies Questions & Answers

moving a file?

i'm trying to move a file from one diectory to another and rename it at the same time. but its giving me an error . " mv: cannot unlink /dir2/file5 : No such file or directory" here is the command I'm using. mv /dir1/file1 /dir2/file5 solaris 8 (1 Reply)
Discussion started by: Holistic
1 Replies

3. Shell Programming and Scripting

Finding & Moving Oldest File by Parsing/Sorting Date Info in File Names

I'm trying to write a script that will look in an /exports folder for the oldest export file and move it to a /staging folder. "Oldest" in this case is actually determined by date information embedded in the file names themselves. Also, the script should only move a file from /exports to... (6 Replies)
Discussion started by: nikosey
6 Replies

4. UNIX for Dummies Questions & Answers

moving file from one folder to another

i have created file in one of the folders on unix UNIX 's36tou -T XYZ /tmp/p400/dataout/ias/AB >/dev/null I am using above command to copy file from one system to unix XYZ is name of file on my system usually this name is very big so i use -T to trim some charaters from name. noe... (1 Reply)
Discussion started by: ajit.yadav83
1 Replies

5. Shell Programming and Scripting

Need help in finding filesize , moving file , gzipping file

Hi , Please help with the following questions 1) how can i find size of a file ? i have written du -k $flname > s1 . Is this right ? Any other better suggeastions ? 2) how do I use mv command for moving the file ? I need the syntax with some examples 3) Command for printing the total... (1 Reply)
Discussion started by: Learning!
1 Replies

6. UNIX for Dummies Questions & Answers

Data file moving

Suppose there is a file “Text1.txt” which contains 100 lines. I need to move 1st 25 line into another file “Text2.txt” How we can do it? Suppose there is a file “Text1.txt” in which city: Bangalore is repeating N times. I need to replace Bangalore with Delhi. How we can do... (1 Reply)
Discussion started by: Rajesh1412
1 Replies

7. UNIX for Advanced & Expert Users

Need help on moving .csv file from UNIX to windows file path

Need help on moving .csv file from unix to windows file path. (1 Reply)
Discussion started by: lakshmanraok117
1 Replies

8. UNIX for Dummies Questions & Answers

Validation before moving the File

Hi, Before moving the files from source directory to target directory I need to check if the files have these strings 'Error', 'Not Valid' ,' YTF-' or if the file is a zero byte file, if the file contains these strings or if it is a zero byte file i should log a entry in the log file and fail... (5 Replies)
Discussion started by: gaur.deepti
5 Replies

9. UNIX for Dummies Questions & Answers

Help! With File Moving

Hello, This is my first post, so please forgive my obvious lack of UNIX knowledge. I am trying/needing to write a script that follows this functional flow: 1. Access a config file that contains format:<directory> <filetype> <daterange> <directory> <filetype> <daterange> <directory>... (2 Replies)
Discussion started by: WildBeard83
2 Replies

10. Programming

Moving a file from one location to another.

Hi, I've done a set of operations on some text files using a someexecutuble.jar file, which is internally calling some python scripts. Post that, in same location, my jar created some log files. However, i'm not able to re-direct the log files to some other location in my windows directory.... (1 Reply)
Discussion started by: arjun_arippa
1 Replies
DH_MOVEFILES(1) 						     Debhelper							   DH_MOVEFILES(1)

NAME
       dh_movefiles - move files out of debian/tmp into subpackages

SYNOPSIS
       dh_movefiles [debhelperoptions] [--sourcedir=dir] [-Xitem] [file...]

DESCRIPTION
       dh_movefiles is a debhelper program that is responsible for moving files out of debian/tmp or some other directory and into other package
       build directories. This may be useful if your package has a Makefile that installs everything into debian/tmp, and you need to break that
       up into subpackages.

       Note: dh_install is a much better program, and you are recommended to use it instead of dh_movefiles.

FILES
       debian/package.files
	   Lists the files to be moved into a package, separated by whitespace. The filenames listed should be relative to debian/tmp/. You can
	   also list directory names, and the whole directory will be moved.

OPTIONS
       --sourcedir=dir
	   Instead of moving files out of debian/tmp (the default), this option makes it move files out of some other directory. Since the entire
	   contents of the sourcedir is moved, specifying something like --sourcedir=/ is very unsafe, so to prevent mistakes, the sourcedir must
	   be a relative filename; it cannot begin with a `/'.

       -Xitem, --exclude=item
	   Exclude files that contain item anywhere in their filename from being installed.

       file ...
	   Lists files to move. The filenames listed should be relative to debian/tmp/. You can also list directory names, and the whole directory
	   will be moved. It is an error to list files here unless you use -p, -i, or -a to tell dh_movefiles which subpackage to put them in.

NOTES
       Note that files are always moved out of debian/tmp by default (even if you have instructed debhelper to use a compatibility level higher
       than one, which does not otherwise use debian/tmp for anything at all). The idea behind this is that the package that is being built can be
       told to install into debian/tmp, and then files can be moved by dh_movefiles from that directory. Any files or directories that remain are
       ignored, and get deleted by dh_clean later.

SEE ALSO
       debhelper(7)

       This program is a part of debhelper.

AUTHOR
       Joey Hess <joeyh@debian.org>

11.1.6ubuntu2							    2018-05-10							   DH_MOVEFILES(1)
All times are GMT -4. The time now is 04:50 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy