Sponsored Content
Top Forums Shell Programming and Scripting Delete an empty file from dir. Post 302181337 by Script40 on Wednesday 2nd of April 2008 04:41:05 PM
Old 04-02-2008
Delete an empty file from dir.

Hi,

I have an dir which has 50K file, some of them are empty. I want to delete the empty file from the dir. I am planning to use the following command.

ls -l | grep " 0 " | awk '{print $9}'

I can copy this to an file and then how do I use this file to delete the empty files.... Any help will be appreciated.Smilie

Thanks.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Based on the permision in the dir can i delete the file

All, I am having a directory as drwxrwsr-x 3 intermec intermec 10240 Jan 8 09:07 intermec inside the directory . the files are like cd -rw-r----- 1 intrmc01 intermec 5226 Dec 2 15:03 AST07356.txt -rw-r----- 1 intrmc01 intermec 5025 Dec 2 12:51... (4 Replies)
Discussion started by: arunkumar_mca
4 Replies

2. UNIX for Dummies Questions & Answers

want to remove " in a file and delete empty spaces

I have to remove character " in file which occurs at every line and have to delete empty spaces. Please help (2 Replies)
Discussion started by: vikram2008
2 Replies

3. Shell Programming and Scripting

empty the dir

i have dir called stock1. it has some 2000 files How to remove/empty the dir in one shot? i tried this command,but its not working rmdir stock1/* stock1/.* (4 Replies)
Discussion started by: ali560045
4 Replies

4. Shell Programming and Scripting

How to make sure dir is really empty

Hi, I have this piece of shell script: #!/bin/ksh x=data1 x=data1 x=data1 for i in 1 2 3 do cp x $IN_DIR done PerformNextTask $IN_DIR is already designed to automatically pick up x and send x to other directory $OK_DIR. $IN_DIR will be empty once all x goes to $OK_DIR.... (2 Replies)
Discussion started by: luna_soleil
2 Replies

5. Shell Programming and Scripting

A script to find dir, delete files in, and then del dir?

Hello!! I have directories from 2008, with files in them. I want to create a script that will find the directoried from 2008 (example directory: drwxr-xr-x 2 isplan users 1024 Nov 21 2008 FILES_112108), delete the files within those directories and then delete the directories... (3 Replies)
Discussion started by: bigben1220
3 Replies

6. Shell Programming and Scripting

How to delete all leading empty lines in a file?

How to delete all leading empty lines in a file? $>cat input.txt test Test $> output file should be test Test $> (14 Replies)
Discussion started by: johnveslin
14 Replies

7. UNIX for Dummies Questions & Answers

How to list all files in dir and sub-dir's recursively along with file size?

I am very new to unix as well as shell scripting. I have to write a script for the following requirement. In have to list all the files in directory and its sub directories along with file path and size of the file Please help me in this regard and many thanks in advance. (3 Replies)
Discussion started by: nmakkena
3 Replies

8. Shell Programming and Scripting

Delete the last empty/blank line of the text file

Hi All, I have a file.txt which seems like having three lines. wc -l file.txt 3 file.txt In fact, once it is open in text editor, this file has four lines where the last line is empty. how can i delete this last empty line of the file.txt? I tried the codes below so far but they... (6 Replies)
Discussion started by: senayasma
6 Replies

9. UNIX Desktop Questions & Answers

How to delete dir and sub dir

Guys, can you tell me how to delete directory and sub directory with files in them, for example: /system/upgrade/title/sub/var/vito/ I would like to delete 'title' and everything under it. Every sub dir contains files which need to be deleted as well. Thanks (1 Reply)
Discussion started by: DallasT
1 Replies

10. Shell Programming and Scripting

Delete everything after empty line in file

Hello, I am trying to remove everything coming after empty line under ubuntu14.04. How may I do it? file: aaa 020390 bb00id3 c03wisi 209dl x092sia 0290s I expect: aaa 020390 bb00id3 c03wisi (3 Replies)
Discussion started by: baris35
3 Replies
JH_SETUPENVIRONMENT(1)						    Javahelper						    JH_SETUPENVIRONMENT(1)

NAME
jh_setupenvironment - Prepares a build environment to compile an eclipse feature. SYNOPSIS
jh_setupenvironment [debhelperoptions] [--pde-build-dir=dir] [copy[...]] DESCRIPTION
jh_setupenvironment is a javahelper program that handles creating an environment for building an eclipse feature. It does not setup an orbit dir (use jh_generateorbitdir for that). It will copy files specified in debian/eclipse.environment as well as those given on command line into the environment dir. If no files are given per command line and the environment file is not present (or is empty), it will default to "org.eclipse.*" FILES
debian/eclipse.environment List of file- and directory glob patterns to copy into the build environment. OPTIONS
--pde-build-dir=dir Specifies where the environment should be or is placed. --clean If passed, jh_setupenvironment will clean up the build environment. When cleaning jh_setupenvironment will not record itself in the debhelper log to avoid confusing dh, when it has to use the log to trace where it was. EXAMPLE
jh_setupenvironment org.eclipse.* debian/*.properties Will clone all files and folders starting with "org.eclipse." and all property files in the debian-folder and put them into the environment. SEE ALSO
debhelper(7) This program is a part of javahelper and uses debhelper as backend. There are also tutorials in /usr/share/doc/javahelper. AUTHOR
Niels Thykier <niels@thykier.net> COPYRIGHT AND LICENSE
Copyright 2010 by Niels Thykier This tool is free software; you may redistribute it and/or modify it under the terms of GNU GPL 2. 0.43 2011-02-17 JH_SETUPENVIRONMENT(1)
All times are GMT -4. The time now is 03:41 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy