Sponsored Content
Top Forums Shell Programming and Scripting Delete all the files and subdirectories for the year 2006 Post 302469023 by samsungsamsung on Thursday 4th of November 2010 12:33:00 PM
Old 11-04-2010
Bug hi

Quote:
Originally Posted by ctsgnb
Code:
find directory -type f -ls | awk '($10=="2006"){print $11}' | xargs -n10 rm

hi

Thanks for your reply.

Is there a way to find how many files and subdirectories are present currently inside the directory with the year stamp as 2006 ?
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

delete compressed files from year 2005

I'm trying to delete files that were created/modified in the year 2005 that we compressed and have the .Z extension on them. I tried using the awk utility but the syntax is incorrect. I don't know how to use a wildcard to capture all the compressed files. Here's the code I used ( ls -lR |... (5 Replies)
Discussion started by: igidttam
5 Replies

2. Shell Programming and Scripting

shell script to find and copy the files creted in the year 2006 to another directory

Hi All, I am new to UNIX. I will be thankful if some one helps me. I have to write a shell script for one of the requirement. I have files created from Jan 2006 to March 2008. My requirement is to write a script in such a way that 1) To find and copy(not Moving) the files created in the... (2 Replies)
Discussion started by: manas6
2 Replies

3. UNIX for Dummies Questions & Answers

Delete files by year

can someone provide a command to delete files by year? I have several files created last year 2009. Im trying to list first ls -lrt | grep '/2009/ {print $10}' by it returns no result. Pls advise (2 Replies)
Discussion started by: lhareigh890
2 Replies

4. Shell Programming and Scripting

How to delete subdirectories that are more than 1 day old AND have NO files on them

Hi Experts , At a particular dir , How to delete subirectories that are more than 1 day old AND have NO files in them. PS : -empty option is not working at my Sun OS version. Thanks, A (6 Replies)
Discussion started by: ajaypatil_am
6 Replies

5. Shell Programming and Scripting

Delete files older than 1 year through FTP

Hi All, I want to login to a remote server using FTP command and then check for files older than 1 year and delete those files. Please let me know how can i achieve this using Unix Commands. Thanks in Advance, (10 Replies)
Discussion started by: HemaV
10 Replies

6. AIX

Want to delete directory, subdirectories and all files which are older than 7 days

how do i remove sub directories of a directory and all files which are older than 7 days by a single command in AIX. pls help me. I am using command as #find /gpfs1/home/vinod/hpc/ -depth -type d -mtime +7 -exec rm -rf {} \; so i want to delete all sub directories and all files from the... (1 Reply)
Discussion started by: vinodkmpal
1 Replies

7. Shell Programming and Scripting

Bash script deleting my files, and editing files in subdirectories question

#!/bin/bash # name=$1 type=$2 number=1 for file in ./** do if then filenumber=00$number elif then filenumber=0$number fi tempname="$name""$filenumber"."$type" if (4 Replies)
Discussion started by: TheGreatGizmo
4 Replies

8. Shell Programming and Scripting

Delete files using year

Hi All, how can i delete files from my Unix directory on the basis of year, i have files from 2001 to till 2014, but from their, i have to delete only 2013 file.Below is my file name rwxrwxrwx 1 guopt users 5169 Jul 12 00:30 grt592_20130712003000.SAP Thanks Kki (2 Replies)
Discussion started by: kki
2 Replies

9. Shell Programming and Scripting

Append string to all the files inside a directory excluding subdirectories and .zip files

Hii, Could someone help me to append string to the starting of all the filenames inside a directory but it should exclude .zip files and subdirectories. Eg. file1: test1.log file2: test2.log file3 test.zip After running the script file1: string_test1.log file2: string_test2.log file3:... (4 Replies)
Discussion started by: Ravi Kishore
4 Replies

10. UNIX for Beginners Questions & Answers

Delete all files created in specific year

I have more than 200K files created in year 2017 under directory having size of 50GB. I want to all these files in one shot. Is there any faster option available with find command to delete all these file ? (6 Replies)
Discussion started by: sp23029
6 Replies
dpkg-name(1)							  dpkg utilities						      dpkg-name(1)

NAME
dpkg-name - rename Debian packages to full package names SYNOPSIS
dpkg-name [options] [--] files DESCRIPTION
This manual page documents the dpkg-name program which provides an easy way to rename Debian packages into their full package names. A full package name consists of <package>_<version>_<architecture>.<package_type> as specified in the control file of the package. The <version> part of the filename consists of the upstream version information optionally followed by a hyphen and the revision information. The <pack- age_type> part comes from that field if present or fallbacks to deb. OPTIONS
-a, --no-architecture The destination filename will not have the architecture information. -k, --symlink Create a symlink, instead of moving. -o, --overwrite Existing files will be overwritten if they have the same name as the destination filename. -s, --subdir [dir] Files will be moved into a subdirectory. If the directory given as argument exists the files will be moved into that directory oth- erwise the name of the target directory is extracted from the section field in the control part of the package. The target directory will be `unstable/binary-<architecture>/<section>'. If the section is not found in the control, then `no-section' is assumed, and in this case, as well as for sections `non-free' and `contrib' the target directory is `<section>/binary-<architecture>'. The section field isn't required so a lot of packages will find their way to the `no-section' area. Use this option with care, it's messy. -c, --create-dir This option can used together with the -s option. If a target directory isn't found it will be created automatically. Use this option with care. -h, --help Show the usage message and exit. -v, --version Show the version and exit. EXAMPLES
dpkg-name bar-foo.deb The file `bar-foo.deb' will be renamed to bar-foo_1.0-2_i386.deb or something similar (depending on whatever information is in the control part of `bar-foo.deb'). find /root/debian/ -name '*.deb' | xargs -n 1 dpkg-name -a All files with the extension `deb' in the directory /root/debian and its subdirectory's will be renamed by dpkg-name if required into names with no architecture information. find -name '*.deb' | xargs -n 1 dpkg-name -a -o -s -c Don't do this. Your archive will be messed up completely because a lot of packages don't come with section information. Don't do this. dpkg --build debian-tmp && dpkg-name -o -s .. debian-tmp.deb This can be used when building new packages. BUGS
Some packages don't follow the name structure <package>_<version>_<architecture>.deb. Packages renamed by dpkg-name will follow this struc- ture. Generally this will have no impact on how packages are installed by dselect(1)/ dpkg(1), but other installation tools might depend on this naming structure. SEE ALSO
deb(5), deb-control(5), dpkg(1), dpkg-deb(1), find(1), xargs(1). AUTHOR
Copyright (C) 1995,1996 Erick Branderhorst This is free software; see the GNU General Public Licence version 2 or later for copying conditions. There is NO WARRANTY. Debian Project 2008-08-18 dpkg-name(1)
All times are GMT -4. The time now is 08:31 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy