Sponsored Content
Top Forums Shell Programming and Scripting Find command to search files in a directory excluding subdirectories Post 302743721 by jhilmil on Thursday 13th of December 2012 07:10:12 AM
Old 12-13-2012
test_2 is a directory and I do not want it in the output, Also, what if there are 15 such subdirectories which I do not want to be listed. How can I generalize the script so that it prints only .dat files in the current directory and also does not list out any subdirectory name
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

search files in a directory and its subdirectories

Hello my friends, I need to write a simple shell bad file :D that search and delete a file it's name 'Microsoft.txt' in the current directory and its subdirectories? So can you help to guide me how i can write this shell, Just give me the beginning :o thank you. (1 Reply)
Discussion started by: Net-Man
1 Replies

2. UNIX for Dummies Questions & Answers

Find Files in a Directory Excluding Subdirectories

Hi, I have a filename Location.txt in a directory /abc. Similar name file is present in its subdirectory /abc/xyz. I want to find the file which is present only in /abc and not in /abc/xyz. Please any1 of u can provide a quick suggestion. Its very urgent. Thanks, Amol (2 Replies)
Discussion started by: Amol_Dicholkar
2 Replies

3. Shell Programming and Scripting

to parse a directory and its subdirectories and find owner name of files

hi all, i need to capture all the files in a directory and its subdirectories that have owner name different than the root owner. for one file it is " stat -c %U filename " but i need to search for each and every file and record it. thanks in advance (14 Replies)
Discussion started by: vyasa
14 Replies

4. Shell Programming and Scripting

Find files of specific size excluding search in a subdirectory

Hi All, I was exploring find command and came across -prune option which would exclude search in a mention subdirectory. My quesry is to search all files more that 100 MB size but exclude search in a subdirectory. I am using below command,but somehow it is not working. Can anybody help me... (6 Replies)
Discussion started by: usha rao
6 Replies

5. Shell Programming and Scripting

Find all files for a user, excluding a directory

I have been searching, and cannot find an answer for this. I am trying to find all files for a user, lets call him (test001), and I want to exclude a specific directory. Here is the command I run, it finds all files: find / -user test001 I get this result: > find / -user test001 ... (4 Replies)
Discussion started by: steve2x4
4 Replies

6. Shell Programming and Scripting

Find files only in current directory...not subdirectories

Hi, I have to find files only in the current directory...not in the sub directories. But when I use Find command ... it searches all the files in the current directory as well as in the subdirectories. I am using AIX-UNIX machine.Please help..I tried to use maxdepth..but it is not working in AIX. (2 Replies)
Discussion started by: vsachan
2 Replies

7. Shell Programming and Scripting

Search subdirectories and find and print total files

Hi All, I have a folder name lets say path/to/folder/CUSTOMER and under this i have several folders and each of these subfolder have serveral subfolders and so on and at some point i will have a folder name called "FTP_FILES" . I need to search for these folders named "FTP_FILES and then... (10 Replies)
Discussion started by: Kevin Tivoli
10 Replies

8. UNIX for Advanced & Expert Users

Find all files in the current directory excluding hidden files and directories

Find all files in the current directory only excluding hidden directories and files. For the below command, though it's not deleting hidden files.. it is traversing through the hidden directories and listing normal which should be avoided. `find . \( ! -name ".*" -prune \) -mtime +${n_days}... (7 Replies)
Discussion started by: ksailesh1
7 Replies

9. Shell Programming and Scripting

Find/searching files in subdirectories excluding the fiels in Parent Directory

Hi All, requirement is to find and remove the files from sub directories but it should exclude the files from parent directory. At present i am using the below one but it finds and remove files from both parent and sub directories. find ${PATH} -type f \( -name securitas\* -o -name \*gz... (1 Reply)
Discussion started by: Naveenkk
1 Replies

10. Shell Programming and Scripting

Append string to all the files inside a directory excluding subdirectories and .zip files

Hii, Could someone help me to append string to the starting of all the filenames inside a directory but it should exclude .zip files and subdirectories. Eg. file1: test1.log file2: test2.log file3 test.zip After running the script file1: string_test1.log file2: string_test2.log file3:... (4 Replies)
Discussion started by: Ravi Kishore
4 Replies
SYSFS(5)						     Linux Programmer's Manual							  SYSFS(5)

NAME
sysfs - a filesystem for exporting kernel objects DESCRIPTION
The sysfs filesystem is a pseudo-filesystem which provides an interface to kernel data structures. (More precisely, the files and directo- ries in sysfs provide a view of the kobject structures defined internally within the kernel.) The files under sysfs provide information about devices, kernel modules, filesystems, and other kernel components. The sysfs filesystem is commonly mounted at /sys. Typically, it is mounted automatically by the system, but it can also be mounted manu- ally using a command such as: mount -t sysfs sysfs /sys Many of the files in the sysfs filesystem are read-only, but some files are writable, allowing kernel variables to be changed. To avoid redundancy, symbolic links are heavily used to connect entries across the filesystem tree. Files and directories The following list describes some of the files and directories under the /sys hierarchy. /sys/block This subdirectory contains one symbolic link for each block device that has been discovered on the system. The symbolic links point to corresponding directories under /sys/devices. /sys/bus This directory contains one subdirectory for each of the bus types in the kernel. Inside each of these directories are two subdi- rectories: devices This subdirectory contains symbolic links to entries in /sys/devices that correspond to the devices discovered on this bus. drivers This subdirectory contains one subdirectory for each device driver that is loaded on this bus. /sys/class This subdirectory contains a single layer of further subdirectories for each of the device classes that have been registered on the system (e.g., terminals, network devices, block devices, graphics devices, sound devices, and so on). Inside each of these subdi- rectories are symbolic links for each of the devices in this class. These symbolic links refer to entries in the /sys/devices directory. /sys/class/net Each of the entries in this directory is a symbolic link representing one of the real or virtual networking devices that are visible in the network namespace of the process that is accessing the directory. Each of these symbolic links refers to entries in the /sys/devices directory. /sys/dev This directory contains two subdirectories block/ and char/, corresponding, respectively, to the block and character devices on the system. Inside each of these subdirectories are symbolic links with names of the form major-ID:minor-ID, where the ID values corre- spond to the major and minor ID of a specific device. Each symbolic link points to the sysfs directory for a device. The symbolic links inside /sys/dev thus provide an easy way to look up the sysfs interface using the device IDs returned by a call to stat(2) (or similar). The following shell session shows an example from /sys/dev: $ stat -c "%t %T" /dev/null 1 3 $ readlink /sys/dev/char/1:3 ../../devices/virtual/mem/null $ ls -Fd /sys/devices/virtual/mem/null /sys/devices/virtual/mem/null/ $ ls -d1 /sys/devices/virtual/mem/null/* /sys/devices/virtual/mem/null/dev /sys/devices/virtual/mem/null/power/ /sys/devices/virtual/mem/null/subsystem@ /sys/devices/virtual/mem/null/uevent /sys/devices This is a directory that contains a filesystem representation of the kernel device tree, which is a hierarchy of device structures within the kernel. /sys/firmware This subdirectory contains interfaces for viewing and manipulating firmware-specific objects and attributes. /sys/fs This directory contains subdirectories for some filesystems. A filesystem will have a subdirectory here only if it chose to explic- itly create the subdirectory. /sys/fs/cgroup This directory conventionally is used as a mount point for a tmpfs(5) filesystem containing mount points for cgroups(7) filesystems. /sys/fs/smackfs The directory contains configuration files for the SMACK LSM. See the kernel source file Documentation/admin-guide/LSM/Smack.rst. /sys/hypervisor [To be documented] /sys/kernel This subdirectory contains various files and subdirectories that provide information about the running kernel. /sys/kernel/cgroup/ For information about the files in this directory, see cgroups(7). /sys/kernel/debug/tracing Mount point for the tracefs filesystem used by the kernel's ftrace facility. (For information on ftrace, see the kernel source file Documentation/trace/ftrace.txt.) /sys/kernel/mm This subdirectory contains various files and subdirectories that provide information about the kernel's memory management subsystem. /sys/kernel/mm/hugepages This subdirectory contains one subdirectory for each of the huge page sizes that the system supports. The subdirectory name indi- cates the huge page size (e.g., hugepages-2048kB). Within each of these subdirectories is a set of files that can be used to view and (in some cases) change settings associated with that huge page size. For further information, see the kernel source file Docu- mentation/admin-guide/mm/hugetlbpage.rst. /sys/module This subdirectory contains one subdirectory for each module that is loaded into the kernel. The name of each directory is the name of the module. In each of the subdirectories, there may be following files: coresize [to be documented] initsize [to be documented] initstate [to be documented] refcnt [to be documented] srcversion [to be documented] taint [to be documented] uevent [to be documented] version [to be documented] In each of the subdirectories, there may be following subdirectories: drivers [To be documented] holders [To be documented] notes [To be documented] parameters This directory contains one file for each module parameter, with each file containing the value of the corresponding parame- ter. Some of these files are writable, allowing the sections This subdirectories contains files with information about module sections. This information is mainly used for debugging. [To be documented] /sys/power [To be documented] VERSIONS
The sysfs filesystem first appeared in Linux 2.6.0. CONFORMING TO
The sysfs filesystem is Linux-specific. NOTES
This manual page is incomplete, possibly inaccurate, and is the kind of thing that needs to be updated very often. SEE ALSO
proc(5), udev(7) P. Mochel. (2005). The sysfs filesystem. Proceedings of the 2005 Ottawa Linux Symposium. The kernel source file Documentation/filesystems/sysfs.txt and various other files in Documentation/ABI and Documentation/*/sysfs.txt Linux 2018-04-30 SYSFS(5)
All times are GMT -4. The time now is 03:44 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy