Sponsored Content
Top Forums Shell Programming and Scripting ls > file - Creating file containing the list of all files present in a directory Post 302240846 by pranavagarwal on Friday 26th of September 2008 07:22:37 PM
Old 09-26-2008
CPU & Memory ls > file - Creating file containing the list of all files present in a directory

Hi All,

I need to create a file which contains the list of all the files present in that directory.

e.g.,

Code:
ls /export/home/user/*.dat > list_file.dat

but what i am getting is:
Code:
$ ls /export/home/user/*.dat > list_file.dat
/export/home/user/*.dat: No such file or directory

But I have the following contents:
Code:
$ ls /export/home/user/*.dat
/export/home/user/a.dat
/export/home/user/b.dat
/export/home/user/c.dat


I am using KSH on a Sun Solaris 5.10 server. Please tell me in case more specifications are required.

Thanks,
Pranav
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

ksh: How to get latest file from a list of files in a directory

Hi, I need to get the latest file from a list of files in a particular directory. Please could anyone help me out to get the file. Thank you, - Jay. (1 Reply)
Discussion started by: Jayathirtha
1 Replies

2. Shell Programming and Scripting

How to Check whether list file present in TXT file exist or not

Hi All, I have txt file which has list of files. I have to check whether these files exist or not. Thanks supriya (6 Replies)
Discussion started by: supriyabv
6 Replies

3. UNIX for Dummies Questions & Answers

Creating a file to count how many files in the directory

hello there i want to creat a file that count how many files i have in the directory. for this i use the command find . -type f | wc -l > 1In1.myfile the problem with this command is that it not update after i add a new file in the directory. Anyone got any ideas how i can... (5 Replies)
Discussion started by: AntiPin
5 Replies

4. UNIX for Dummies Questions & Answers

Creating a list of files in directory?

Hi All, I would like to do a loop on all the files with extension .out in my directory this files should be sorted alphabetically. Then I need to assign to each of them a progressive ID of three digits (maybe in HEX format?). First I tried to list manually the files as ARRAY=( A-001.out ... (5 Replies)
Discussion started by: f_o_555
5 Replies

5. Shell Programming and Scripting

Script to list files not present in audio.txt file

I am having following folder structure. /root/audios/pop /root/audios/jazz /root/audios/rock Inside those pop, jazz, rock folders there are following files, p1.ul, p2.ul, p3.ul, j1.ul, j2.ul, j3.ul, r1.ul, r2.ul, r3.ul And I have a file named as "audio.txt" in the path /root/audios,... (11 Replies)
Discussion started by: gopikrish81
11 Replies

6. Shell Programming and Scripting

List file NOT present in other directory

Dear community, I have one LOG directory with some files. What I need to do is list ONLY the files that are not present in other directory. Using Bash programming! LOG DIR | SYNC DIR FILE1 | FILE1 FILE2 | FILE3 FILE3 | OTHER FILENAME FILE4 ... (9 Replies)
Discussion started by: Lord Spectre
9 Replies

7. UNIX for Dummies Questions & Answers

Need help how to create a file (xml) list all files from directory

I have more than 10K songs in two directories on a hard drive. I would like to create a file list all of files name then change to .xml extension to upload to iPhone so I have a Karaoke list on my iPhone. I need your help to create a file by using command in Linux. Files names: 0001 More... (4 Replies)
Discussion started by: ggcc
4 Replies

8. Shell Programming and Scripting

How to copy all the contents of a list of files present in a folder to a particular file?

Hi All, I want to copy all the contents of a list of files in a folder to a particular file. i am using following command: cat dir/* >> newFile.txtIt's not working. Could you please help? Thanks, Pranav (3 Replies)
Discussion started by: Pranav Bhasker
3 Replies

9. Shell Programming and Scripting

Systemd errors of missing file “No such file or directory” inspite of file being present

The contents of my service file srvtemplate-data-i4-s1.conf is Description=test service for users After=network.target local-fs.target Type=forking RemainAfterExit=no PIDFile=/data/i4/srvt.pid LimitCORE=infinity EnvironmentFile=%I . . . WantedBy=multi-user.target (0 Replies)
Discussion started by: rupeshkp728
0 Replies

10. Shell Programming and Scripting

Total record count of all the file present in a directory

Hi All , We need one help on the below requirement.We have multiple pipe delimited .txt file(around 100 .txt files) present on one directory.We need the total record count of all the files present in that directory without header.File format as below : ... (8 Replies)
Discussion started by: STCET22
8 Replies
slack(8)						      System Manager's Manual							  slack(8)

NAME
slack - Sysadmin's lazy autoconfiguration kit SYNOPSIS
slack [option ...] [role ...] DESCRIPTION
slack is a master command which coordinates the activities of its backends, which variously: o determine the list of roles to be installed on this server o create a local cached copy of the role files from the central repository o merge file trees from subroles into a single, unified tree o install files onto the local filesystem o run scripts before and after installation Options you give to slack will be generally passed along to the backends where relevant. OPTIONS
-h, --help Print a usage statement. --version Print the version and exit. -v, --verbose Increase verbosity. Can be specified multiple times. --quiet Don't be verbose (Overrides previous uses of --verbose). -C, --config FILE Use the specfied FILE for configuration instead of the default, /etc/slack.conf. -s, --source DIR Source directory for slack files -e, --rsh COMMAND Remote shell for rsync -c, --cache DIR Local cache directory for slack files -t, --stage DIR Local staging directory for slack files -r, --root DIR Root destination for slack files --no-sync Skip the slack-sync step (useful if you're pushing stuff into the CACHE outside slack). --no-files Don't install any files in ROOT, but tell rsync to print what it would do. --no-scripts Don't run scripts -n, --dry-run Same as --no-files --no-scripts (CACHE, STAGE will still be updated) --role-list Role list for slack-getroles(8). -b, --backup Make backups of existing files in ROOT that are overwritten. This option defaults to on if it is not set to 0 in a config file or disabled with --nobackup on the command line. --backup-dir Put backups from the --backup option into this directory. -H, --hostname HOST Pretend to be running on HOST, instead of the name given by gethostname(2). --preview MODE Do a diff of scripts and files before running them. MODE can be one of 'simple' or 'prompt' (See PREVIEW MODES, below). --diff PROG Use this diff program for previews. --sleep TIME Randomly sleep between 1 and TIME seconds before starting operations. Useful in crontabs. PREVIEW MODES
Preview functionality is new in slack 0.14.0. I haven't quite worked out how things will work, so this usage is somewhat subject to change in future versions. I thought I would try it this way and see how people like it. In 'simple' mode, after syncing and staging the files directory, slack will present a diff of the files and scripts. In this mode, slack will not run the preinstall or fixfiles scripts, and because of this, it may provide some false output about permissions changes to files. In 'prompt' mode, after syncing and staging the files directory, slack will diff the script directory. If there are differences, slack will present them to you and ask you if you want to continue. If you say no, it will exit. If you say yes, it will stage the scripts directory, run the preinstall and fixfiles scripts, and then diff the files in the stage with those in the root. If there are differences, slack will present them to you and ask you if you want to continue. If you say no, it will exit. If you say yes, it will install the files and run the postinstall script. So, the 'simple' mode is easy to use, and will be accurate if you don't use fixfiles. The 'prompt' mode will be accurate if you use fix- files, but requires some interaction. Why can't we just have one mode that works with fixfiles and requires no interaction? Well, that would require slack to understand what your free-form fixfiles executable was going to do, which would either require some kind of universe simulator or would require you to write your fixfiles in a less free-form way, which would make slack less like slack. EXAMPLES
To install all the roles configured in the role list for a server: slack To install a specific role: slack rolename To test a new role before checking in the changes: slack --source user@workstation:/home/user/.../slack rolename To avoid killing your master server when calling from cron: slack --sleep 3600 FILES
/etc/slack.conf SEE ALSO
slack.conf(5), rsync(1) Administrative commands 2004-10-22 slack(8)
All times are GMT -4. The time now is 02:07 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy