Sponsored Content
Full Discussion: Space in the directory name
Top Forums UNIX for Advanced & Expert Users Space in the directory name Post 7873 by devnul on Tuesday 2nd of October 2001 09:09:54 PM
Old 10-02-2001
Well, I have to say that there may be a more practical way of doing what you want... I mean, why not just have something which prunes away files that are over say 30-days old?...

Something like:
Code:
#!/usr/bin/perl

$volume=$ARGV[0];
@dirs=`find /usr/$volume -name Trash`;
$curtime=time();
$number_days=30;
foreach(@dirs)
{
  chomp();
  opendir(DIR,$_);
  while($fname=readdir(DIR))
  {
    ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks)=stat($fname};
    # 60 seconds, 60 minutes, 24 hours
    if($ctime < $curtime-(60*60*24*$number_days))
    {
      unlink $fname;
    }
  }
}

NOTE: You will want to test this because I haven't (!!!!!).... It's just an idea...

- dEvNuL

added code tags for readability --oombera

Last edited by oombera; 02-20-2004 at 11:41 AM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Space left under current directory

What utility (or combination of utilities) can I use to find out how much disk space a directory and its subdirectories take up. I currently am using 'df' to see partition space/size, 'ls' doesn't seem like displaying directory info TIA SmartJuniorUnix (2 Replies)
Discussion started by: SmartJuniorUnix
2 Replies

2. Shell Programming and Scripting

Check directory space?

Is there some command I can use to check to see if there is 2 Gig of space available in a directory before I created a 2 Gig file? (3 Replies)
Discussion started by: lesstjm
3 Replies

3. Filesystems, Disks and Memory

Space Used by Directory Tree

Can someone tell me how I can determine how much space (blocks) have been used by a given directory tree? I periodically need to know how much space is consumed by a directory and all of its files and subdirectories and their files in either KB or blocks. I have tried df and du but these do not... (1 Reply)
Discussion started by: johnk99
1 Replies

4. UNIX for Dummies Questions & Answers

How do I increase disk space available to a directory?

I know very basic Unix commands s I would really appreacite the assistance of a Unix guru. I am installing an application on a Sun server, when attempting to install I get an error that says I do not have enough sapce allocated for my install directory. Error says it has 7235m but needs 15360m.... (2 Replies)
Discussion started by: rhack
2 Replies

5. UNIX for Dummies Questions & Answers

Space issue with Directory

Hi, How can I check whether a directory has enough space to create file? I have checked the space is availabe in the file system. For example: the directory /var/tmp resides in root file system. In the root file system currently 20% (5.5gb) space availabe. but how can I check the in the /var/tmp,... (1 Reply)
Discussion started by: siba.s.nayak
1 Replies

6. Red Hat

/boot directory out of space

We applied updates on saturday and noted that we have used 97% of our /boot directory. How can I tell what files i can keep or get rid of in this directory? or how can I increase the size of this partition. Red Hat Enterprise Linux ES release 3 (Taroon Update 9) 2.4.21-57.ELsmp Thank... (4 Replies)
Discussion started by: redac
4 Replies

7. Shell Programming and Scripting

find the free space of a particular directory

Hi Guys, I want to find the free space of a particular directory,, Regards, Magesh (3 Replies)
Discussion started by: mac4rfree
3 Replies

8. UNIX for Dummies Questions & Answers

Adding space to a directory?

I need to add space to certain directory. I believe I need to add space to the filesystem this directory belongs to. How can I find out what filesystem this directory belongs to? (3 Replies)
Discussion started by: NycUnxer
3 Replies

9. UNIX for Dummies Questions & Answers

Display all directory/sub directory with occupied space?

Hello, I am using Red Hat linux system. I see my /work directory has used space 300GB. But there are so many sub directory under /work. I want to list each direcotry and under all subdirectory. But i want to know how much space occupied by each directory. What kind of command i can use to... (3 Replies)
Discussion started by: govindts
3 Replies

10. Shell Programming and Scripting

Handle space in directory name

I have two servers in subject, say server1 and server2. I have shell scripts on server1. We have a directory on server2 from where the files need to be scp to server1. The directory on server2 is having space in its name. I have script on server1 that takes the directory path of server2 as a... (4 Replies)
Discussion started by: Longfellow
4 Replies
gvfs-trash(1)							   User Commands						     gvfs-trash(1)

NAME
gvfs-trash - move a directory entry to the trash using the VFS system SYNOPSIS
gvfs-trash URI DESCRIPTION
gvfs-trash moves a directory entry to the trash using the VFS system. OPERANDS
The following operands are supported: URI Specifies the file location in standard URI format. EXAMPLES
Example 1: Move a local file to the trash example% gvfs-trash file:///tmp/example Example 2: Move a remote object to the trash example% gvfs-trash smb://server/dir/example ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables: NLSPATH. EXIT STATUS
The exit value 0 is returned regardless of success or failure. FILES
The following files are used by this application: /usr/bin/gvfs-trash Executable to move a directory entry to the trash using the VFS system ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWgnome-gvfs | +-----------------------------+-----------------------------+ |Interface stability |Volatile | +-----------------------------+-----------------------------+ SEE ALSO
gvfs-copy(1), gvfs-info(1), gvfs-less(1), gvfs-ls(1), gvfs-mkdir(1) gvfs-monitor-dir(1), gvfs-monitor-file(1), gvfs-mount(1), gvfs-move(1), gvfs-rename(1), gvfs-open(1), gvfs-cat(1), gvfs-save(1), gvfs-trash(1), gvfs-tree(1), attributes(5), environ(5) NOTES
Written by Alvaro Lopez Ortega, Sun Microsystems Inc., 2008. SunOS 5.11 25 Mar 2008 gvfs-trash(1)
All times are GMT -4. The time now is 02:04 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy