Print all the directory with no directory name mydir


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Print all the directory with no directory name mydir
# 8  
Old 02-14-2013
Quote:
Originally Posted by DGPickett
Well, sometimes it is cheaper to "2>/dev/null" than to test for potential directories or files.
To quote Grace Hopper:
Quote:
It's easier to ask forgiveness than it is to get permission.
That maxim comes to mind every time I see code contorted to avoid harmless errors.

Regards,
Alister
# 9  
Old 02-14-2013
Well, not quite up to the forgiveness/permission level! More hidden requirements for the competence of those who use and maintain, avoiding anything that might cause them to overreact, like 'normal errors', so sometimes it is important to have none logged. It has more to do with the local culture. Shops vary enormously in that.
# 10  
Old 02-14-2013
Quote:
Originally Posted by DGPickett
Well, not quite up to the forgiveness/permission level!
Trying to avoid error messages with pre-emptive file existence checks is indeed a matter of asking for permission instead of forgiveness. Further, it's a faulty approach because of the race between the check and the subsequent command.

Regards,
Alister
# 11  
Old 02-15-2013
Race situations are not easy to process error free, like if you mv input_file3976 input_file3976_$$ and it errors ENOENT, someone else renamed it first. If input_file3976_$$ exists, you got there first, and used directory file locking to get control of the file cleanly.

Luckily, most scripts run in a quiexcent situation.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Loop through directory and print on line

In the bash below I am trying to loop through all the R1.gz in a directory (always 1), store them in ARRAY, and cut them before the second _. That is being done but I can't seem to print then one a single line seperated by a space. Is the below the best way or is there a better solution? Thank you... (3 Replies)
Discussion started by: cmccabe
3 Replies

2. UNIX for Advanced & Expert Users

A way to print only part of directory path

Hi, So I struggled to find a solution to the following problem: I want to make sed print only part of multiple different paths. So lets say we have /path/path1/path2/logs/bla/blabla /path/path1/path2/path3/logs/yadda/yadda/yadda Can someone suggest a way to make sed or other... (5 Replies)
Discussion started by: dampio
5 Replies

3. Shell Programming and Scripting

Directory containing files,Print names of the files in the directory that are exactly same content.

Given a directory containing say a few thousand files, please output a list of all the names of the files in the directory that are exactly the same, i.e. have the same contents. func(a_directory_name) output -> {“matches”: , ... ]} e.g. func(“/home/my/files”) where the directory... (7 Replies)
Discussion started by: anuragpgtgerman
7 Replies

4. Shell Programming and Scripting

Print the current directory using perl

Hi I have this code to print the current directory using Perl use Cwd qw(abs_path); my $path = abs_path($0); print "$path\n"; But it is displaying my perl source code file along with the directory. like this C:\Perl\duration.pl But I want it only to display this... (1 Reply)
Discussion started by: srijith
1 Replies

5. Shell Programming and Scripting

[awk] print all filenames in directory

Hello, I was given a (I suppose) a simple task which I don't know how to do. Before coming here I have read a dozen of awk tutorials (full read, not just line-skipping) but I still don't know how to do this. Task: Write an script file 'check.awk' with a parameter current directory that... (5 Replies)
Discussion started by: c0dehunter
5 Replies

6. Shell Programming and Scripting

Print directory name along with their path

Can any one tell me that how can i print all directory with their path in a given parent directory. i.e. parent directory /home/usr/ Now this shoe directory may contain sevral directory /home/usr dir1/ dir1.1/ dir1.2/ dir2 dir2.1/ dir2.2/ ... (5 Replies)
Discussion started by: jadoo_c2
5 Replies

7. Solaris

delete buffer from print directory

Hi all, Operting system : Solaris 9 Oracle application: 11.5.10 i would like to ask query related to buffer area of pinter on solaris server. we are trying to print cheques using oracle application on network printer. some times it is printing the cheques with out any problem but... (1 Reply)
Discussion started by: maooah
1 Replies

8. Shell Programming and Scripting

How to print a directory list to a file?

I have directory of files listed with stats. I need to print only files with the same stats to a file. I tried this, and it printed a blank document. *1556 > tmp/list it did not work any suggestions? (3 Replies)
Discussion started by: rocinante
3 Replies

9. Shell Programming and Scripting

print all files of a directory

At the moment I do not know anything UNIX script :rolleyes: but i need to make script that prints the content of the archives (of text) that are deposited in a directory and Later erases these archives, leaving the directory emptiness It would be like repository for print please... (9 Replies)
Discussion started by: monica
9 Replies
Login or Register to Ask a Question