General :: Shell Script To Copy All Folders Older Than 7 Days?

Mar 16, 2011

I want to make the script to copy all folders which older than 7 days from Linux server to Windows server by Samba. And make it automatically by using cron

View 4 Replies


ADVERTISEMENT

General :: Delete Backups Older Than 7 Days Through Shell Script?

Jul 15, 2011

I am having my own testing server in which mySQL database will be backed up daily. in the format mysql_backup_dd/mm/yy.tar.gz in my home folder I need to setup a cron job to delete the backups older than 7 days.how to do this.

View 3 Replies View Related

General :: Command To Copy Files Older Than <n> Days Keeping Dir Structure?

Jul 6, 2010

I'm trying to truncate a postfix Maildata directory for one of our users. I want to be able to move any files older than <n> days to a new location, but also copying the relevant directory structure. This should be doable in the one comman. I've used find to locate the files, and mv to move them, but I can't figure out how to build the directoryt structure on the fly in the new location.

This is what I have so far:

Code:
find /Maildata/editor -mtime +42 -type f -exec mv -v {} /EditorEmailOld/ ; > ~/editor.txt

View 4 Replies View Related

General :: Delete Files When It's Older 30 Days?

Jan 6, 2011

I am trying to put together ksh shell and I am new with writing scripts.How do you write a command to delete any files if it's 30 days old and also it's not currently being locked?

View 10 Replies View Related

General :: Delete Old Files Older Than 7 Days?

Sep 18, 2009

find -type f /path/* -mtime +7 -exec rm {} ;Is this the best way to delete only files (not directories) within /path that are older than 7 days? or is there a better way?

View 3 Replies View Related

General :: Script To Compress A Directory And Then Delete Older Than 7 Days

Feb 3, 2010

I have been trying to write a script that will take a directory, for example /accounts compress it into a .tar file with the filename containing the date of compression, for example accounts030210.tar and then place that file into a directory called /archive

I also want the script to delete files in /archive that are older than 7 days.

View 3 Replies View Related

General :: Copy Files Less Than 7 Days Old?

May 6, 2011

I have searched for a way to copy file less than X days old and I found this:http://www.howtogeek.com/howto/ubunt...days-on-linux/ The syntax for deleting files less than 7 days old would be like this:find /path/to/files* -mtime -7 -exec rm {} ;I would like to copy the files to mntas, and I'm not sure what the syntax should be.ould this work?find /path/to/files* -mtime -7 -exec cp {} mnt
as ;

View 3 Replies View Related

Programming :: Delete Files Older Than 7 Days?

Jan 3, 2011

I am new to unix, I am looking for a script to delete files older than 7 days but i also want to exclude certain directories (like arch,log .....) and also some files with extensions ike .ksh, .ch, ..............) in directories and sub directories

View 4 Replies View Related

CentOS 5 :: Delete Files Older Than 7 Days?

Jan 26, 2010

I've been trying to delete all files older than 7 days in a directory temp1.I have try different ways but nothing happend:

find /temp1/* -mtime +7 -exec rm rf
find . -mtime +7 -exec rm rf
find /temp1/* -mtime +7 -print -exec rm{}

View 13 Replies View Related

Programming :: Write Synatax To Delete Stuff Older Than 8 Days?

Mar 31, 2011

I got this part from my script working that it will delete a folder is from 8 days agoEightDaysAgo=`(date --date="8 days ago" +%d-%m-%Y)`rm -rf $EightDaysAgoTarHowever I need to remove files that are older than 8days for example if the script is'nt run for a day it will remove both the 9th and 8th day one not just the 8th day one. If I'm making any sense lol

View 3 Replies View Related

Ubuntu Servers :: Rotation Part Is Not Removing Files Older Than 90 Days?

Dec 3, 2010

Seem my rotation part is not removing files older than 90 days. Anybody know what is wrong?

Code:
#!/bin/sh
#navigate to the desired backup location
cd /public/backup/linux
#dump the MySQL entirely, output file is dated
mysqldump -u root -pmt1jxz68f2 --all-databases > "`date +%Y%m%d`.sql"
#backup the web folder

[Code]...

View 1 Replies View Related

Ubuntu :: Delete Files In Trash That Is Older Than 10 Days With A Terminal Command?

Sep 27, 2010

Can I delete files in trash that is older than 10 days with a terminal command?

View 3 Replies View Related

Server :: Script To Delete Files Older Than X Days Fstab Has Noatime Enabled?

Jul 26, 2011

I have set up a simple find and delete script for files older than X days. The problem is that some of the files that are send in this share are transfered from an archive server and creation/modified date remains the same when copied and the age of them could be a year ago or older and they get deleted over night by the script.For performance reasons the raid is mounted with noatime in fstab.Do you see any solution to this problem except enabling atime?I'm thinking at some more advanced script that writes the list of added files once a day and marks them for deletion after some time.

View 2 Replies View Related

General :: Run Rsync On Server A To Copy All Files From Server B When They Are Newer Than 7 Days

Jun 14, 2011

I want to run rsync on server A to copy all files from Server B when they are newer than 7 days.(find . -mtime -7) I don't want to delete the files on Server B.

View 2 Replies View Related

General :: Copy One File To All Folders?

Apr 4, 2009

I am developing a Web-based application and have some folders that will generally reside outside of the Web accessible area of the server. However, since some people will not be able to store those folders outside of the "public_html" folder, I am looking to put a blank "index.php" inside of every folder within that section of the application. To make things easier, I would like to know if there might be a way to recursively copy one file into every folder in a certain location.

In other words, is there a command that might do something like:
Code:
> cp -R index.php /home/user/public_html/source-files/*
Basically, I want every directory inside of "source-files" to get a copy of "index.php". The directory hierarchy within "source-files" can go at least three or four levels deep, so the command would need to be recursive. I am looking for a command-line statement that I can type to perform this action.

View 3 Replies View Related

General :: Copy All Files Except From Some Certain Folders?

Jan 19, 2010

At the moment I'm using:"cp -ap . /destination-folder"to copy everything from the folder I'm in to another folder.That works.Is it possible to cp everything except:folder1/folder2/in the current folder I'm in?

View 2 Replies View Related

Ubuntu Networking :: Copy Files From XP Infact Folders Using TERMINAL In Netbook, Not Copy And Paste Using Mouse?

Jul 9, 2010

just installed ubuntu couple of days back on my netbook. I am still a beginner, enjoying my adventure exploring ubuntu. I have another desktop which runs on XP. I am able to access XP shared folders through my netbook(linux). However, i wanted to copy files from XP infact folders using TERMINAL in my netbook, not copy and paste using my mouse. Are there any commands for it?

View 1 Replies View Related

General :: Copy Symlinks To Target As Normal Folders?

Nov 30, 2010

i have a folder with symlinks:

marek@marek$ ls -al /usr/share/solr/
razem 36
drwxr-xr-x 5 root root 4096 2010-11-30 08:25 .

[code]....

i want to copy it to ~/solrTest but i want to copy files from symlink as well when i try to cp -r /usr/share/solr/ ~/solrTest i will have symlink here:

marek@marek$ ls -al ~/solrTest
razem 36
drwxr-xr-x 5 root root 4096 2010-11-30 08:25 .
drwxr-xr-x 358 root root 12288 2010-11-26 12:25 ..

[code]....

View 4 Replies View Related

General :: Copy All Files And Folders From Specific Date?

May 26, 2011

I wanna copy all folders and files created from 01.01.2011 until today to new placeie:cp -r /home/moviecar/public_html/wp-content/uploads/ /home/teaser/public_html/wp-content/uploads

View 4 Replies View Related

General :: Copy A Set Of Sub Folders From Their Multiple Parent Directories To A New Location

Nov 5, 2010

I am attempting to copy a set of sub folders from their multiple parent directories to a new location.

For example, I have three folders to copy:

I would like them to be copied to:

In actuality there are many folders besides folder1, folder2, folder3, and no numerical order exists. So, the folder named 'photos' would be copied to its parent folder's name in a new location. I would need this to occur for all folders in the '/home/user' directory.

View 6 Replies View Related

General :: Copy Folders From Windows Machine To System Script?

Oct 7, 2010

I'm looking for a script to run that will be run from my linux box to copy folders from a windows server at a certain time on a daily basis.

View 2 Replies View Related

General :: Copy To 'clipboard' From Shell?

Apr 5, 2010

Seems a utility called "xclip" and "xsel" are required, but is there anything simpler, that doesn't require extra utilities, along the lines ofCode:cat foo.txt > clipboardThis would for GNOME.

View 9 Replies View Related

General :: Windows 7 - Backup Folders To External SFTP Server With Shadow Copy

Mar 1, 2010

I have an account in university on Linux machine with 10TB of free space accessible via SFTP. I would like to backup my Windows 7 x64 laptop to university. Currently I am using rsync+cygwin, but backup is pretty slow (without shadow copy) and I hate console window appearing every day on my screen when I login.

So I am looking for something like Windows Backup but with support for SFTP. Combination of tools will work too.

View 3 Replies View Related

General :: Shell Script To Delete Folders And Files Dynamically And Recursively?

Jun 7, 2010

I have an archive directory that needs to be cleaned up once per quarter. The top level (/data/archive/*) directory names change daily, as well as the subdirectories and the filenames (the application names everything according to date). Also, there are two top level directories, bin and incoming, that we can't touch. I want to write a shell script that loops through the 15 or 20 top level directories and deletes all files and subdirectories older than 3 days (skipping the bin and incoming folders). Can someone get me started on a script? I am kinda new to shell scripting.

View 2 Replies View Related

Software :: Obtain An Older Copy Of KMM To Retrieve The Data?

Sep 17, 2010

I was using 9.10 Ubuntu and was going to update to 10.??. Being an intelligent person, I made four (4) backups of KMyMoney on different diskettes and thumb drives. Now, the problem, after reinstalling my O/S (new version) I reinstalled KMyMoney and found out that the newer version of KMM will not read the data I have backed up.What I need is a way to obtain an older copy of KMM so I can retrieve my data. Then I can update.

View 2 Replies View Related

General :: Copy Images From Diff Folder In Shell?

Apr 20, 2011

I have 500 folders of templates in one folder. Now each folder has file called template_thumbnail.png . now i want something so that all those files get copied to one folder with name same as the home folder name

I have cygwin installed and i can copy that folder in there so basically it will linux shell script

View 1 Replies View Related

General :: Copy From 1 Computer To Another With System Shell Commands?

Jun 23, 2011

I want to copy a file (home/remote_computer_user/Desktop/test1.txt) from my remote office computer (a permanent URL + open port) to my home computer (home/home_computer_user/Downloads/).

How can I do this with shell commands in Linux?

My current thoughts:

ssh <user>@<computer1address> -p <port> - gives me a shell on the remote computer
(I think I should use scp, but I dont how exactly how in my case)

What are the exact commands I should use?

View 1 Replies View Related

General :: Copy / Paste Output From Shell (not Terminal)?

Jul 15, 2010

I often have issues starting my window manager--xfce. My computer misbehaves in one of 3 ways, one of which is to fail to open X, but generate several screens of info. I want to paste that info to this site, but since I'm in the shell, not the terminal (please correct my vocabulary if it's wrong here), I don't know how to copy and paste the output, since right-clicking doesn't give me a menu. Even if I could copy I'm not sure the information would be accessible in X. Are there any other options?

View 13 Replies View Related

General :: Shell Script To Shutdown Virtual Machines / Copy And Than Start VM?

Mar 16, 2011

I need to make my 1st ever script to backup VMware workstation VMs to a folder which is then backed up offsite. Here is what I have so far (will be croned):

Code:

sudo vmrun -T ws stop "/home/gareth/vmware/NagiosWeb/NagiosWeb.vmx" soft
sudo vmrun -T ws stop "/home/gareth/vmware/UbuntuBackup/UbuntuBackup.vmx" soft
**copy or rsync to /home/gareth/vmware-backup/ dir**

[code]....

1. Just to confirm, I need to place the above in a file with #!/bin/bash at the top and make it executable.

2. How do I know when the VMs have safely shut down so I can start the copy? I guess I can either a. wait a specified amount of time b. run some sort of if statement to confirm they are off.

3. How do I use Rsync or cp to copy to the backup folder?

4. How will I know the copy is complete so that I can start the VMs again?

View 3 Replies View Related

General :: System Bash Shell Copy Previous Lines (not History) With Keyboard?

Jun 14, 2011

Is it possible to use the keyboard in order to select some text in the terminal windows that is not in the currently edited line? (for example, in order to copy part of previous command output).

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved