Server :: Keeping Only The Most Recent 10 Files?

Dec 13, 2010

I need a quick script that will help me keep only the most recent 10 files in a directory.

The files look something like this:
-rw-r----- 1 root root 34816 Dec 13 13:06 3_270_737318733.dbf
-rw-r----- 1 root root 709120 Dec 13 13:06 3_271_737318733.dbf
-rw-r----- 1 root root 63488 Dec 13 13:06 3_272_737318733.dbf
-rw-r----- 1 root root 316416 Dec 13 13:06 3_273_737318733.dbf
-rw-r----- 1 root root 113664 Dec 13 13:06 3_274_737318733.dbf
code....

I need to eliminate the older files, and keep only the most current.

I've done a ls -l | sort -r and written that to a file i can read into a loop. That's where i'm running into difficulty. The difficulty being, that I don't know how to keep only the most current 10 files.

View 1 Replies


ADVERTISEMENT

CentOS 5 Server :: Vsftpd Not Showing (recent) Files

Sep 14, 2009

I am running FTP server using vsftpd 2.0.5-12 on Centos 5.3 64bit with default settings, annonymous access enabled. Each night new files are created and moved into a FTP subdirectory (/var/ftp/spectra) by a script. The files are owned by a local user/group, not root, and the same holds for the /var/ftp/spectra subdirectory. The new files are not visible via FTP. Only visible are files that were created the same day when I made the directory /var/ftp/spectra. Also files that are created "in place", e.g. by vi, are visible until I change their owner/group. This is the situation when vsftpd is runned as a system service (/etc/init.d/vsftpd start).

When I start the vsftpd directly using the command /usr/sbin/vsftpd (both without or with the configuration file specified), all files are visible and normally accessible via FTP.

View 4 Replies View Related

Ubuntu :: Keeping Show Hidden Files Unchecked

Jan 5, 2010

I want hidden files to be hidden, so I open the folder that has the hidden files in it and select View, and untick "Show Hidden Files". However, when I access the folder again the box is ticked and the files are showing. How can I get it to stay hidden permanently?

View 5 Replies View Related

Red Hat / Fedora :: Adding Third Drive Keeping Share Under Var Files

Aug 7, 2010

I am just starting out in linux and am a little confused about mounting drives. On my fedora pc, I have 2 x hard drives. When I originally installed the os, I had 1 drive with the default partitioning. I placed all my data into /var/files and had various folders under there e.g. music, video, docs etc. It didn't take long for this to fill up. So I added a 2nd drive and mounted it as /var/files which increased the space for all the folders in that directory. So my fstab has:
sda1 /
sdb1 /var/files

Now its filling up again and I want to add a 3rd drive. But this time, I want to separate my music from my video's etc but still keep the share under /var/files. So, do I add the 3rd drive, mount it as /var/files/music1, then transfer the music files from /var/files/music to /var/files/music1 and once the transfer is complete, delete /var/files/music, rename /var/files/music1 to /var/files/music and then mount sdc1 to/var/files/music? The bit I can't get my head around is the mount within a mount:
sdb1 /var/files is mounting everything under it including /music
If I add sdc1 /var/files/music how does it affect the mount point of sdb1
Am I better putting the /music under /var/music instead of /var/files?

View 8 Replies View Related

Debian Configuration :: Keeping The Dns Server Running With Current Server Information?

Jun 26, 2010

I'm running the current release of Debian with the 2.6.26-2 kernel. This is an upgrade from an older (2.4 kernel) series redhat release. One of the things I had working in the older system was a dns server with accompanying monthly update of the root hints file. I tried working through a dns how-to to set this up again, but it seems much has moved around since I last played with this. All of the files listed in the how-to are not where it says they should be. I am looking for a better reference on keeping the dns server running with current server information.

View 1 Replies View Related

Programming :: Rename Files Recursively, Only Keeping Last X Digits Plus Extension?

Nov 29, 2009

My problem is this:I have a number of directories, all containing files of different name lenghts, including letters, numbers and possibly spaces. I want to recursively rename all of these files, so that only the _last_ 5 digits (not counting the extension) remain. In other words: I want to cut off all but the last 5 digits and not touch the extension.

I've tried to read up on tr, rename (perl version), sed, cut etc. and browsed through some threads here, but so far couldn't quite figure out how to do it.

If someone could point me to the right (standard) CLI tools and syntax.

View 2 Replies View Related

Ubuntu :: Copy Only Most Recent Files From A Directory?

Mar 4, 2011

I am using Gpodder for the moment and would like to copy the 3 most recent podcast episodes of every podcast to a second directory (in fact the second directory resides on my android phone, mounted via usb)The setup is as followsGpodder downloads the episodes in

/home/PODCASTS/podcast 1/
/home/PODCASTS/podcast 2/
/home/PODCASTS/podcast 3/

[code]....

View 9 Replies View Related

Ubuntu :: Keeping Files Moved From NTFS Partition To EXT3 Safe

Mar 13, 2010

Long story short, my Windows had a fatal crash the other day and since I couldn't find the installation disk, I burned the Ubuntu 9.10 disk image to a CD at a friend's place and installed it on one partition of the hard drive. The other partition contained tons of Windows programs and documents in an NTFS system. Ubuntu is cool and all, but when I finally found the Windows disk, I wanted to reinstall it for dual-booting, to use some programs that don't run well in Wine.

To keep some documents safe and not waste any CDs, I moved them over to the Ubuntu partition before installing Windows. As experienced ubuntuists know, the slightly clumsy Windows installer erases GRUB in the process, and it's recommended to install Windows first. So, now I ended up with a working Windows partition and an Ubuntu partition with all of the stored data, which I can access via guest status with the burned CD.

Here's the catch though - as a guest and without Linux properly installed I can't move anything I moved to the Linux partition from the Windows partition back anymore. All the folders have a little X on their top corner. I'd be glad to reinstall Ubuntu now, but I must know how to keep all that tranferred data safe. Can I keep it there during the reinstallation? Should I install Wubi on Windows and access the stuff through it?

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

Ubuntu :: Modify Number Of Recent Files In Gedit ?

Apr 27, 2010

Is it possible to change the number of files that are displayed by the recent files list in gedit? Running Ubuntu 9.04x64. Gedit says it's 2.26.1

View 2 Replies View Related

Ubuntu Installation :: Upgrade 9.10 From Wubi To Full Install While Keeping Files And Settings?

Apr 25, 2010

I want to upgrade my 9.10 from Wubi to a full install (my 30 gigs is almost filled) without losing my files and settings(like my panel apps and options). but how?

View 2 Replies View Related

General :: Find Duplicate Files And Delete All Except Most Recent Version

Aug 17, 2010

I have a directory containing a ton of photos, some of which are duplicates but just with different names. Is there any way in linux to find all the duplicates and remove all of them except the most recent version? I know on Windows there are utilities that will do this through a GUI, but I'm using Linux through the CLI only.

View 6 Replies View Related

Server :: Increasing HDD Size While Keeping Data Intact

Jun 15, 2010

I'm currently setting up a server with 2x 1TB disks in raid1. (Centos 5.5)In the future, if the storage is insufficient and I decide to upgrade the disks to 2x 2TB, could I just:

- dump ghost image of the array on usb drive
- replace hdd's and build new array
- ghost array with image created previously

Would the above work, will the new partition automatically resize to 2TB or do I need to partition right now with LVM? would it work with LVM?

View 1 Replies View Related

Server :: Sendmail Isn't Sending Mail For Some Reason And Keeping It In The Queue

May 14, 2011

Sendmail isn't sending mail for some reason and keeping it in the Queue. I attemped to flush them but it deferres the connection to the server in which it is trying to relay the message to. I have checked to see if there is a DNS error or anything like that. I attemped to flush the messages through webmin.

This is the result.

Code:

I am not finding anything in the logs to let me know their is an error. I can ping the mail servers that it is trying to send to. Now it has started delaying when ping MX servers. So I knew something was starting to mess with it. I have checked the /etc/hosts. It is correct. The server isn't black listed. Mail to root just gives me.

Code:

View 2 Replies View Related

Programming :: Keeping The Separate Files In Sync Line By Line?

May 5, 2010

I'm extracting data from a xml file writing it to separate files then combining the results as a csv file.The problem is keeping the separate files in sync line by line.When a grep does not action I would like to put in a blank line or something to keep the lines in order.When the "<title>" is missing as in as in the first"<programme </programme>" that's where I need somethingto write to the file as dummy data to increment the line

here's the data

Code:

<programme channel="15552.dvb.guide" start="20100504200000" stop="20100504204000">
<category>Show / Game Show</category>
</programme>
<programme channel="14498.dvb.guide" start="20100504200000" stop="20100504203000">

[code]....

View 14 Replies View Related

Ubuntu :: Remove "recent" On Files And Folders New 11.04?

May 3, 2011

On the new 11.04 when you select files and folders, "recent" are displayed at the top, and I can't find any options to make "recent" never appear. I don't know who, on a personal and not work PC, would want their recently uploaded and opened documents and files displayed at a simple click. Imagine this, I take dirty pics with the wife, I upload them to a secret folder, I use the same computer to show vacation pictures to my mom, I click on "files and folders", and poof, my mom sees naked pics of my wife displayed right across the "recent" files and folders section right at the top, regardless of the location of those files on the computer. So to avoid these situations, I would like to know how to disable the "recent" section of files and folders quick pop-out display.

View 5 Replies View Related

CentOS 5 Server :: Automation Of Ftp Server \ Configure A FTP Server Where Upload And Download Files?

Jan 8, 2011

i have been trying to complete the following project1) Configure a FTP server where we can upload and download files.........2) server must run at 9 pm & stop at 9 am automatically ............although the first task was easy ,i have no idea how to accomplish the 2nd task(not to mention I'm a new user)

View 5 Replies View Related

Ubuntu :: Keeping Time To EST?

Mar 23, 2011

I have a Ubuntu 10.04 box that I want to keep on Eastern Standard Time. Under the Time & Date GUI I select the correct time zone, put it in Manual mode, set the time and it is fine until I reboot. Then the clock advances one hour about 20 seconds after boot. I don't remember this happening a month ago before DST started. Does anyone know of a way to keep the beast on EST, not EDT?

View 2 Replies View Related

Red Hat :: Yum Update Keeping OS Version

Jan 23, 2011

Is it possible to yum update the OS keeping its version?I run Red Hat Enterprise 5.4, and I would like to yum update it without getting Red Hat Enterprise 5.5, or 5.6.

View 3 Replies View Related

Debian :: Keeping Machine Online

Apr 11, 2016

I would like to keep machine connected to router but want it to be accessible only from inside the network. How would I do that?

View 9 Replies View Related

General :: Keeping A RAMdisk Out Of Swap

Dec 15, 2010

I'm using some milters on a Sendmail box that recommends using a RAMdisk [tmpfs] to store temporary files, the performance benefits of which are quite noticeable. However, the problem is if a huge number of messages are all delivered at once this partition can be pushed off the physical memory and into swap. When this happens the performance tanks to about 1/20th to 1/30th of normal.Is there anything I can do to keep a tempfs from being swapped to disk?

View 3 Replies View Related

OpenSUSE Hardware :: Keeping HDD Alive With 11.3?

Sep 8, 2010

I have been having problems keeping my hard drives alive with openSUSE 11.3, it is happening way to often and I'm starting to think its more than bad luck. The hard drives that I have been using are brand new 500 GB Western Digital hard drives. Once I get it I would do SMART test on it, which all turn out clean, then a couple of months later I go to boot my system and I am fronted with a { DRDY ERR } { UNC}. Checking the SMART selftest log from the repair mode on the DVD I get a read failure at about 10% of the drive, the LBA of first error is: 578307645. I can't keep replacing the HDD ever couple of months its just getting way to expensive.

View 5 Replies View Related

Ubuntu :: Keeping System Up To Date?

Apr 22, 2010

Was curious about keeping a running system up to date. Can any harm come from running the following:sudo apt-get updatesudo apt-get upgradeWhat I mean is, is it possible that doing the above could cause a perfectly healthy system to go foobar? If so, what's the best way to prepare a system for a recovery. The Server in question is a Hardy BIND server. In the past, I've seen some ugly things happen to Windows systems after running updates, so I'd like to err on the side of caution.

View 1 Replies View Related

Ubuntu Servers :: Keeping Up To Date

Apr 22, 2010

Fairly new to Ubuntu server. Was curious about keeping a running system up to date. Can any harm come from running the following:

sudo apt-get update
sudo apt-get upgrade

What I mean is, is it possible that doing the above could cause a perfectly healthy system to go foobar? If so, what's the best way to prepare a system for a recovery. The Server in question is a Hardy BIND server. In the past, I've seen some ugly things happen to Windows systems after running updates, so I'd like to err on the side of caution.

View 4 Replies View Related

Ubuntu :: 10.04 Firefox Not Keeping Logins

May 20, 2010

i have 10.04 installed through wubi on my school hard drive and i notice that after i turn it off, then later put it in one of the many computers, firefox seems to forget i had things to keep me logged in, such as this forum.

now it could be that i use it on different computers(all have the same hardware), but its just odd if you ask me this doesn't get in the way of use but is happening.

Code:
Linux ubuntu 2.6.32-22-generic #33-Ubuntu SMP Wed Apr 28 13:28:05 UTC 2010 x86_64 GNU/Linux
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.3) Gecko/20100423 Ubuntu/10.04 (lucid) Firefox/3.6.3
cookies are enabled

View 4 Replies View Related

Ubuntu :: Download And Run KDE While Keeping Gnome

Oct 14, 2010

I want to download KDE to run on Ubuntu Maverick, as well as keep Gnome.
I tried:
sudo apt-get install kde-minimal
But that package no longer exists. So, what is the KDE-Core (which doesn't exist anymore either) package now? Where do I go to search for current packages? I've looked in Launchpad, but that's more to add repositories and track bugs.

View 4 Replies View Related

General :: Keeping Xandros 4.1 Up To Date.

Jan 11, 2010

Xandros isn't keeping its repostorie Apps. updated. I tried Ubuntu 9.04 and it was good with only a minor change, (wireless was slow). Got a workround from Ubuntu forum. Login as root I was able to fix it, I updated to Ubuntu 10. Wireless was slow again. I tried logging on as root. Ubuntu 10. has lockout root and sudo won't let me add (iwconfig wlan rate 54M) to a boot up program to fix it. I went back to 9.04 now it wouldn't let me sign in as root. I next tried Debian Lenny. The screen res. was 1600 x 900? And for Dabian Lenny the screen res. is set automatically and can't be set manually, so I could not finish the install. So I'm back to Xandros 4.1 needing help to keep it up to date.

View 2 Replies View Related

Server :: After Moving PHP Files To /var/www They No Longer Are Seen As Hosted Php Files

Feb 25, 2010

I am setting up a Demo website that I am hosting in a Debian Lenny VM, I have installed Apache, mySQL, and PHP5 I know the php server is working because if I place an info php file I can see it in the browser. However, I downloaded phpfusion, as well as phpmyadmin and they are on my desktop, I open a superuser file browser (also added write access to /var/www to everybody and copied the files over as me) and copied over the files. Once in the www folder they are no longer seen as "valid" php files, if I try to access them with iceweasel, IE, Konquerer it asks me if I want to download the file. If I look at the files on my desktop they have different icons. I have attached a screenshot. I can't tell what the difference is, but obviously there is one otherwise the icons wouldn't be different. Does anyone have any idea what's going on here or a way to rectify it?

View 9 Replies View Related

Debian :: Keeping A Removed Package (hypermail) Around

Nov 11, 2010

Unless I am mistaken, the 'hypermail' package has recently been removed from unstable.

I don't know if this is permanent or if it is just in preparation for the upcoming release.

In case it might be permanent, I thought that I'd download the deb from stable and stick it in a new directory '/var/local/apt'. Then I ran 'dpkg-scanpackages' in that directory and sent the output to '/var/local/apt/Packages'.

Unfortunately, when I run 'aptitude', 'hypermail' still shows up under the 'obsolete' section, even after I do a package update.

Have I done anything obviously wrong?

View 1 Replies View Related

Fedora :: Keeping Multiple Versions Of A Package?

Jan 1, 2010

Some times i need the older version of some packages in my system...side by side with the new one.i.e mostly i found older version openssl package for supporting dependency of some programs Can I keep the following libraries at the same time in my system by installing multiple versions of openssl?

[Code]...

View 3 Replies View Related







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