print all files of a directory


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting print all files of a directory
# 1  
Old 11-02-2006
Bug print all files of a directory

At the moment I do not know anything UNIX script Smilie
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 help me

thanks

monica
# 2  
Old 11-03-2006
you may use cat command to print contents of text files, once they are extracted from the archived file.

use rm command to delete files once you are done with printing
# 3  
Old 11-03-2006
Code:
MYDIR=/home/sri
cd $MYDIR
ls -1 $MYDIR | lp  # list all the file in sri directory and print those file by lp command

use this simple code ..still you want more help
pls give full details with simple example....
# 4  
Old 11-03-2006
MySQL

Thanks Yogesh and thanks srikanthus too.

i think that will use the option "ls -1 $MYDIR | lp "

another question....
If i want to automatice How i do?
May be very interesante every 5 minutes print the contens of the directoy , (and this script must be resident) How i do ?

Thanks again

monica

PD: excuseme but my english is not too good
# 5  
Old 11-03-2006
save this script, chmod 755, and put a line in the cron file to execute the script at desired time; call it directly like : /home/user/script. ot the respective location.
# 6  
Old 11-03-2006
thanks sysgate ....!

well
i`m working in the idea but i dont have de unix here(i am at home it is for the work)

I need opinions about this

Work? Smilie Smilie

MYDIR=/usr/xgf/mislib/ftp2prn

cd $MYDIR

ls -l > /usr/tmpA
cantarch = `wc -l /usr/tmpA`

if ($cantarch > 0) then
ls -1 $MYDIR | lp
ls -1 $MYDIR | rm
rm tmpA
else
rm /usr/tmpA
endif


Regards

Monica
# 7  
Old 11-04-2006
I understood that you want to execute this script automatically.
for this you will have to enter in crontab file...


pls dig up this link , you must get the useful info ...
Try this https://www.unix.com/answers-to-frequently-asked-questions/13527-cron-crontab.html

thanks
srikanth
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Print number of lines for files in directory, also print number of unique lines

I have a directory of files, I can show the number of lines in each file and order them from lowest to highest with: wc -l *|sort 15263 Image.txt 16401 reference.txt 40459 richtexteditor.txt How can I also print the number of unique lines in each file? 15263 1401 Image.txt 16401... (15 Replies)
Discussion started by: spacegoose
15 Replies

2. UNIX for Beginners Questions & Answers

Search strings from a file in files in a directory recursively; then print the string with a status

Hi All, I hope somebody would be able to help me. I would need to search a string coming from a file, example file.txt: dog cat goat horse fish For every string, I would need to know if there are any files inside a directory(recursively) that contains the string regardless of case.... (9 Replies)
Discussion started by: kokoro
9 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

List files with date, create directory, move to the created directory

Hi all, i have a folder, with tons of files containing as following, on /my/folder/jobs/ some_name_2016-01-17-22-38-58_some name_0_0.zip.done some_name_2016-01-17-22-40-30_some name_0_0.zip.done some_name_2016-01-17-22-48-50_some name_0_0.zip.done and these can be lots of similar files,... (6 Replies)
Discussion started by: charli1
6 Replies

5. AIX

How to set owner and permission for files/directory in directory in this case?

Hi. My example: I have a filesystem /log. Everyday, log files are copied to /log. I'd like to set owner and permission for files and directories in /log like that chown -R log_adm /log/* chmod -R 544 /log/*It's OK, but just at that time. When a new log file or new directory is created in /log,... (8 Replies)
Discussion started by: bobochacha29
8 Replies

6. UNIX for Dummies Questions & Answers

Print all the directory with no directory name mydir

directory structure: 100k server1/ab_1234567_1/mydir 500k server1/ab_1234567_2 100k server1/ab_1234567_3/mydir 100k server1/ab_1731458_9/mydir 600k server1/ab_1234569_1 100k server1/ab_1234569_4/mydir 100k server1/ab_1234510_40/mydir 800k server1/ab_1234511_1 is there any way to generate... (10 Replies)
Discussion started by: lxdorney
10 Replies

7. Shell Programming and Scripting

Help needed to print the not updated files in the Directory

Hi All, I have written one program to print the files which are not updated in the specified directory in .Dat file. If I am executing the same command in the command prompt its working fine but if I am executing in shell script it's not working fine. Please correct if any thing wrong in the... (3 Replies)
Discussion started by: bbc17484
3 Replies

8. Shell Programming and Scripting

Print the name of files in the directory using Perl

Hi All, I am stuck with a problem and i want your help, what i want to do is I have a directory name dircome and there are 6 files present in this directory, the name of the files are d1,d2,d3,d4,d5,d6. The Perl script print the files name, means the output should be d1 d2 d3 d4 d5 d6 (9 Replies)
Discussion started by: parthmittal2007
9 Replies

9. 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

10. Shell Programming and Scripting

FTP files from different directory from remote server to one directory in local

Hi All, I want to search for .log files from folders and sub folders in remote server and FTP them to one particular folder in the local machine. I dont want to copy the entire directory tree structure, just have to take all the .log files from all the folders by doing a recursive search from the... (3 Replies)
Discussion started by: dassv
3 Replies
Login or Register to Ask a Question