Sponsored Content
Full Discussion: Removing older version files
Top Forums Shell Programming and Scripting Removing older version files Post 302766647 by balajesuri on Tuesday 5th of February 2013 05:52:05 AM
Old 02-05-2013
Code:
#! /bin/bash

n=$1
x=`ls -l | wc -l`
for y in $(ls -1t | tail -$(( $x - $n ))); do rm -rf $y; done

This User Gave Thanks to balajesuri For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

removing files after 6 hours or older

What is the command to remove files that are generated 6 hours or older? The find and remove tells only how to remove if the file is one day old or more. Appreciate quick reply. Thanks (3 Replies)
Discussion started by: gthokala
3 Replies

2. UNIX for Advanced & Expert Users

Need older version of System Firmware for 7026-H80

Hi all, I have an H80 that I'm migrating to 5.3 and prior to doing so it needed the firmware upgraded. I don't have copies of the old firmware that was on it since I was not the one who installed it and there were no copies to be found on the server itself. I installed the latest version and... (4 Replies)
Discussion started by: howardle
4 Replies

3. UNIX for Dummies Questions & Answers

Removing files older than 7 days

Script help, I need to delete files that are older than 7 days. I do that automatically but I know that a cron job can do the job for me. Any help is greatly appreciated, as you can see, I am a DOS or WINDOWS guy. Little on UNIX. Thanks (3 Replies)
Discussion started by: texasoeb
3 Replies

4. UNIX for Dummies Questions & Answers

.profile has been replaced and need to get the older version

Hi All, .profile has been replaced with a new one. I need to know the variables used in the older version of .profile. I have a session opened using the old .profile. Is there a way that I can get the exact file. I had some luck by using set command. But is there any way that I can get the... (5 Replies)
Discussion started by: shash
5 Replies

5. Shell Programming and Scripting

Removing files older than one week in a directory

Hi, I need a shell script to remove the files older than a week in a directoy and if necessary to zip the files. (2 Replies)
Discussion started by: sudhakaryadav
2 Replies

6. UNIX for Advanced & Expert Users

removing files older than n days

Hi, on AIX 6.1, is there any commande line to remove the files older than n days in a directory ? Thanks. (2 Replies)
Discussion started by: big123456
2 Replies

7. Shell Programming and Scripting

For loop in older version of ksh

When I am trying to use below code of for loop on older version of ksh it not working,and I just want to use only FOR loop ----------------- for i in (1..5) do echo $i done ----------------- please suggest.it really stoping me. FYI: i want to do this only by for loop (2 Replies)
Discussion started by: RahulJoshi
2 Replies

8. Ubuntu

Installation of older version of rsyslog

Hi, I am trying to downgrade the version of rsyslog to the older version (i.e) and when i issue the below command to check the packages i dont see the required package (i.e) and when i try to install it is complaining about package not found. Please advise on how to install the... (1 Reply)
Discussion started by: prash358
1 Replies

9. Debian

Which older version and variant ISO image should I use?

Which older version and variant of Debian Linux ISO image should I use? I attempted to install two versions of Debian Linux Operating System onto my older full tower computer. First version, V8.5.0, Amd64, xfce, 32Bit. Second version V7.11.0, i386, 32Bit. When trying to install... (1 Reply)
Discussion started by: Jefferyab6
1 Replies

10. UNIX for Beginners Questions & Answers

How to install older package version on Ubuntu 18.04?

Hello, I'm running Ubuntu 18.04 and I would like to install libboost-python version 1.46. Currently I have installed version 1.65: wakatana@local-machine:~$ dpkg -l | grep libboost-python ii libboost-python-dev 1.65.1.0ubuntu1 amd64 ... (1 Reply)
Discussion started by: wakatana
1 Replies
virt-copy-out(1)					      Virtualization Support						  virt-copy-out(1)

NAME
virt-copy-out - Copy files and directories out of a virtual machine disk image. SYNOPSIS
virt-copy-out -a disk.img /file|dir [/file|dir ...] localdir virt-copy-out -d domain /file|dir [/file|dir ...] localdir DESCRIPTION
"virt-copy-out" copies files and directories out of a virtual machine disk image or named libvirt domain. You can give one of more filenames and directories on the command line. Directories are copied out recursively. EXAMPLES
Download the home directories from a virtual machine: mkdir homes virt-copy-out -d MyGuest /home homes JUST A SHELL SCRIPT WRAPPER AROUND GUESTFISH
This command is just a simple shell script wrapper around the guestfish(1) "copy-out" command. For anything more complex than a trivial copy, you are probably better off using guestfish directly. OPTIONS
Since the shell script just passes options straight to guestfish, read guestfish(1) to see the full list of options. SEE ALSO
guestfish(1), virt-cat(1), virt-copy-in(1), virt-edit(1), virt-tar-in(1), virt-tar-out(1), http://libguestfs.org/. AUTHORS
Richard W.M. Jones ("rjones at redhat dot com") COPYRIGHT
Copyright (C) 2011-2012 Red Hat Inc. LICENSE
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. BUGS
To get a list of bugs against libguestfs, use this link: https://bugzilla.redhat.com/buglist.cgi?component=libguestfs&product=Virtualization+Tools To report a new bug against libguestfs, use this link: https://bugzilla.redhat.com/enter_bug.cgi?component=libguestfs&product=Virtualization+Tools When reporting a bug, please supply: o The version of libguestfs. o Where you got libguestfs (eg. which Linux distro, compiled from source, etc) o Describe the bug accurately and give a way to reproduce it. o Run libguestfs-test-tool(1) and paste the complete, unedited output into the bug report. libguestfs-1.22.6 2013-08-24 virt-copy-out(1)
All times are GMT -4. The time now is 11:39 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy