Sponsored Content
Full Discussion: Scripting for Inventory
Top Forums Shell Programming and Scripting Scripting for Inventory Post 302539428 by kshji on Sunday 17th of July 2011 12:58:57 PM
Old 07-17-2011
ls can list recursively
Code:
ls -1R

But if you need csv format for Excel then example:
Code:
#!/usr/bin/ksh
# or bash or dash or ...
# ls2

# directories
dirs=$(find . -type d | sed "s/^.\///")

nowdir=$PWD
# filelist / dir
echo "$dirs" | while read dir
do
        cd "$nowdir/$dir"
        files=$(find . -type f | sed "s/^.\///")
        echo "$files" | while read file
        do
                echo "$dir;$file"
        done
done

Then
Code:
chmod a+rx ls2
./ls2 > mylist.csv

---------- Post updated at 07:58 PM ---------- Previous update was at 07:06 PM ----------

Or you can make XML format which is also usable into Excel.
Code:
# directories
xmlout()
{
cat <<EOF
<File>
  <Dir>$1</Dir>
  <Filename>$2</Filename>
</File>
EOF
}


#MAIN
dirs=$(find . -type d | sed "s/^.\///")

# XML header
cat <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<dataroot xmlns:od="urn:schemas-microsoft-com:officedata">
EOF

nowdir=$PWD
# filelist / dir
echo "$dirs" | while read dir
do
        cd "$nowdir/$dir"
        files=$(find . -type f | sed "s/^.\///")
        echo "$files" | while read file
        do
                xmlout "$dir" "$file"
        done
done
echo "</dataroot>"

 

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Software Inventory

How can I find out what software is installed on the machine, other than ls? Is there a registry program like in Windows? The os is Sun 2.5. Thanks (1 Reply)
Discussion started by: ViperD
1 Replies

2. UNIX for Advanced & Expert Users

Collecting software inventory

how to obtain/ collect a list of all the applications installed in the system.. is there a configuration file(like the one which exists for hardware ) which holds all this information?? if no is there any command/shell script or utility that we can use for the same ?? I am using Red hat linux... (2 Replies)
Discussion started by: superghost
2 Replies

3. Shell Programming and Scripting

File Inventory Scan

Is there such a script out there that will Analyze a folder and subfolders, getting file type utilization and file aging. A CSV file will be created with file information File,Size,Date Created,Last Modified,Last Accessed,Extension,File Type,Owner A Summary report text file will also be created... (4 Replies)
Discussion started by: seacros
4 Replies

4. Shell Programming and Scripting

Help on editing inventory

Hi guys, im currently doing a library database program, and i need help for the following commands my library.txt is Google:Harry:45.00:50:100 This is my code echo "Please enter Title" read BookTitle echo "Please enter Author" read Author echo "Price" read Price ... (2 Replies)
Discussion started by: ichar
2 Replies

5. UNIX for Dummies Questions & Answers

Folders and Files Inventory

Hi , We are migrating our scripts from one unix server to another unix server in aix. Is there any way we can export the permissions, owner, group of the folders and files inside the folders. If I am copying xyz folder from old server, I need to generate a report with permissions ,owner and... (5 Replies)
Discussion started by: shruthidwh
5 Replies

6. Solaris

Inventory details - Solaris

i need to extract following information through command line on solaris machine : 1.manufacturer name (hardware as well as OS) 2.Model number 3.Serial number - Serial Number of the device or the Physical device serial number for Virtual Servers 4.whether the server is physical or virtual -... (3 Replies)
Discussion started by: omkar.jadhav
3 Replies

7. UNIX for Advanced & Expert Users

Server inventory software

Hi, do you know any good server inventory open source products? I want information like, server hostnames, ram, cpu, os, filesystems, volume groups, disks, adapters, installed software versions, firmware levels and so on os: aix, solaris, linux, hpux data should be kept in a database, web... (7 Replies)
Discussion started by: funksen
7 Replies

8. UNIX for Advanced & Expert Users

UNIX/Linux inventory - Open Source

Hello guys, I need an open source tool that can list all the softwares installed in my unix/linux servers, the tool should list all the softwares installed and the current version, grouped by the hostname, anybody know any solution for this specific problem? Thanks guys, have a good day! (7 Replies)
Discussion started by: denisloide
7 Replies
IRSEND(1)								FSF								 IRSEND(1)

NAME
irsend - basic LIRC program to send infra-red commands SYNOPSIS
irsend [options] DIRECTIVE REMOTE CODE [CODE...] DESCRIPTION
Asks the lircd daemon to send one or more CIR (Consumer Infra-Red) commands. This is intended for remote control of electronic devices such as TV boxes, HiFi sets, etc. DIRECTIVE can be: SEND_ONCE - send CODE [CODE ...] once SEND_START - start repeating CODE SEND_STOP - stop repeating CODE LIST - list configured remote items SET_TRANSMITTERS - set transmitters NUM [NUM ...] SIMULATE - simulate IR event REMOTE is the name of a remote, as described in the lircd configuration file. CODE is the name of a remote control key of REMOTE, as it appears in the lircd configuration file. NUM is the transmitter number of the hardware device. For the LIST DIRECTIVE, REMOTE and/or CODE can be empty: LIST "" "" - list all configured remote names LIST REMOTE "" - list all codes of REMOTE LIST REMOTE CODE - list only CODE of REMOTE The SIMULATE command only works if it has been explicitly enabled in lircd. -h --help display usage summary -v --version display version -d --device use given lircd socket [/var/run/lirc/lircd] -a --address=host[:port] connect to lircd at this address -# --count=n send command n times EXAMPLES
irsend LIST DenonTuner "" irsend SEND_ONCE DenonTuner PROG-SCAN irsend SEND_ONCE OnkyoAmpli VOL-UP VOL-UP VOL-UP VOL-UP irsend SEND_START OnkyoAmpli VOL-DOWN ; sleep 3 irsend SEND_STOP OnkyoAmpli VOL-DOWN irsend SET_TRANSMITTERS 1 irsend SET_TRANSMITTERS 1 3 4 irsend SIMULATE "0000000000000476 00 OK TECHNISAT_ST3004S" FILES
/etc/lirc/lircd.conf Default lircd configuration file. It should contain all the remotes, their infra-red codes and the corresponding timing and wave- form details. DIAGNOSTICS
If lircd is not running (or /var/run/lirc/lircd lacks write permissions) irsend aborts with the following diagnostics: "irsend: could not connect to socket" "irsend: Connection refused" (or "Permission denied"). SEE ALSO
The documentation for lirc is maintained as html pages. They are located under html/ in the documentation directory. lircd(8), mode2(1), smode2(1), xmode2(1), irrecord(1), irw(1), http://www.lirc.org. irsend 0.8.7pre1 May 2010 IRSEND(1)
All times are GMT -4. The time now is 09:08 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy