Sponsored Content
Top Forums Shell Programming and Scripting Deleting the file only to all the directory and sub directory Post 302272207 by kingganesh04 on Tuesday 30th of December 2008 01:36:55 AM
Old 12-30-2008
i want to remove only the files not the directory
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Deleting A Directory!

This must be simple! How do you delete a directory that contains other files and directories?:confused: (2 Replies)
Discussion started by: firefinger
2 Replies

2. Programming

problem deleting date-time stamped file in a directory

I have a number of files of the format filename.xfr_mmddyy_%H%M%S which i get in a specified directory daily. Now i want to search in the specified directory & delete the files which are more than 2 days old .So I use a command find $DIR/backup/* -ctime +2 -exec rm -f {} \; But after executing... (1 Reply)
Discussion started by: dharmesht
1 Replies

3. Shell Programming and Scripting

Deleting the oldest file in a directory

Hey! I have found similar posts both here and on other sites regarding this, but I cannot seem to get my script to work. I want to delete the oldest file in a test directory if there are more than two files. My script is currently: #!/bin/bash MEPATH=/usr/local/bin/test FILECOUNT=`ls... (4 Replies)
Discussion started by: Immolation
4 Replies

4. Shell Programming and Scripting

Deleting a type of file in a directory immediately it occurs

Hi All, I have to maintain few servers and in those servers in a specific directory some special jobs keeps on running ....... The directory is having many kind of files like.....acd*, hud*, rca*....bla bla bla....... My aim is that if due to any job-any time a file having initials like... (4 Replies)
Discussion started by: jitendra.pat04
4 Replies

5. Shell Programming and Scripting

Grepping file names, comparing them to a directory of files, and moving them into a new directory

got it figured out :) (1 Reply)
Discussion started by: sHockz
1 Replies

6. Shell Programming and Scripting

Change to directory and search some file in that directory in single command

I am trying to do the following task : export ENV=aaa export ENV_PATH=$(cd /apps | ls | grep $ENV) However, it's not working. What's the way to change to directory and search some file in that directory in single command Please help. (2 Replies)
Discussion started by: saurau
2 Replies

7. UNIX for Dummies Questions & Answers

Deleting a directory and zipping another directory

Hi Folks, I have a directory in unix that is /usr/local/pos contain the folowing directoreis ..that is dir1 dir2 dir3 now I want to delete only dir2 please advise how to remove the directory dir 2 ..that is rm command and how to use it , and second if I want to zip the dir3 please... (1 Reply)
Discussion started by: punpun66
1 Replies

8. Shell Programming and Scripting

Shell scripting-I need a script which should watch a directory for a file with specific directory

I need a script which should watch a directory for a file with specific directory. If it finds a file in directory, it should search for few specific keyword in the file. if the keyword exists, it should trim string from specific column. The file should be moved to another directory and the a... (8 Replies)
Discussion started by: akashdeepak
8 Replies

9. AIX

Deleting a Directory

I have a directory under my home directory called: my work. I cannot delete this directory and I want to. If anyone needs additional information. Please let me know. Any help you can provide is greatly appreciated. (8 Replies)
Discussion started by: Nerdgirl1313
8 Replies

10. Shell Programming and Scripting

Shell script cannot create directory and move the file to that directory

I have a script, which is checking if file exists and move it to another directory if then mkdir -p ${LOCL_FILES_DIR}/cool_${Today}/monthly mv report_manual_alloc_rpt_A_I_ASSIGNMENT.${Today}*.csv ${LOCL_FILES_DIR}/cool_${Today}/monthly ... (9 Replies)
Discussion started by: digioleg54
9 Replies
rmdir(2)							System Calls Manual							  rmdir(2)

NAME
rmdir() - remove a directory file SYNOPSIS
DESCRIPTION
The system call removes a directory file whose name is given by path. The directory must be empty (except for the files and before it can be removed. RETURN VALUE
returns the following values: Successful completion. Failure. is set to indicate the error. ERRORS
If fails, is set to one of the following values. [EACCES] A component of the path prefix denies search permission. [EACCES] Write permission is denied on the directory containing the link to be removed. [EACCES] The process does not have read/write access permission to the parent directory. [EBUSY] The directory to be removed is the mount point for a mounted file system. [EBUSY] The path is the current working directory. [EEXIST] The named directory is not empty. It contains files other than and [EFAULT] path points outside the process's allocated address space. The reliable detection of this error is implementation- dependent. [ELOOP] Too many symbolic links were encountered in translating the path name. [ENAMETOOLONG] The length of the specified path name exceeds bytes, or the length of a component of the path name exceeds bytes while is in effect. [ENOENT] The named file does not exist. [ENOTDIR] A component of the path is not a directory. [EPERM] The directory containing the directory to be removed has the sticky bit set and neither the containing directory nor the directory to be removed are owned by the effective user ID. [EROFS] The directory entry to be removed resides on a read-only file system. AUTHOR
was developed by the University of California, Berkeley and HP. SEE ALSO
mkdir(2), unlink(2), remove(3C), privileges(5). STANDARDS CONFORMANCE
rmdir(2)
All times are GMT -4. The time now is 01:39 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy