Programming :: Make List Of Directories Which Contain Files Other Than Subdirs?

Oct 17, 2009

I need to, through a bash script, go through a given directory (given as argument 1) to list out the relative path in this directory (including $1) for eact subdirectory which contains files. Directories which only contain . .. and eventually only subdirectories SHALL NOT be listed. It is this last requirement that makes it difficult for me.

I have been using the tree command for now, but I have not found a way to ignore paths to directories which only contains other subdirs or nothing at all in any easy way. I may offcourse test each directory after they are listed but this gives an extra loop to go through and I beleive it should be possible to do it directly when creatring the list. I guess by using find or ls in conjuntion with the tree command or by itself it should be possible but I am not to conversant of nested script commands.

View 9 Replies


ADVERTISEMENT

General :: Make A List Of Directories And Files?

Jun 3, 2011

My system is centos 5.5, and I need nobody:nobody's directories and files under data.

There is a directory named "data, and this directory has so many directories and files generated by web program. Most of them is nobody:nobody.

I want to to make a list of these nobody:nobody directories ans files.

Is it possible to make a list of these directories and files?

View 1 Replies View Related

Programming :: Make A Program That Maintains A List Of Tags That Can Be Attached To A Set Of Files?

Jul 28, 2010

I want to make a program that maintains a list of tags that can be attached to a set of files. Store the tags in the files. The main problem is that there is no way to get a list of all the tags without reading each and every file. And also what if you have an unused tag? Have a file that contains tag "keys" and file list "values". This seems like it would be fast and effective, but what if one of the files gets renamed?

View 12 Replies View Related

General :: List Directories And Number Of Files Inside Them

Mar 19, 2011

I'm looking for a way to produce a list of all the directories in the current working directory sorted by the total number of files that are contained with them.

Initially I though that Nautilus could be used for this, but then I realised it doesn't count files in the sub directories.

The best I've got for a command line solution so far is this

Code:

The use case for this is a situation where a user has a quota applied to their home directory which limits the number of files they are allowed to have and they have exceeded that limit.

View 4 Replies View Related

General :: List Files In Specific Directories Older Than 1 Day Or 24 Hours

Apr 7, 2011

I am trying to write a simple back up script in python where I try to list the files that are 24 hours old in specific directories that I would choose.I read the manual of find and used

find . -mtime 1 > log.dat

to get the list of files in the log.dat however I also get the path information in that list as such

./hpc06MatlabCodes/2011/Apr/3dBoxModel
./hpc06MatlabCodes/2011/Apr/3dBoxModel/vfluidIrca10.dat
./hpc06MatlabCodes/2011/Apr/3dBoxModel/vLRecoveredSystem.mat

is there a way to exclude the directories and only get the files list.

View 2 Replies View Related

General :: Chmod Doesn't Change Permissions On Files In Subdirs

May 15, 2011

I have a Qnap 219p NAS to which I have connected a USB external harddrive. I can access the external harddrive from my windows box using the network share, but at first i couldn't access the folders. The permissions set in the NAS GUI for the external drive is correct and are identical to the permissions set to the 2 internal drives.

I ssh'ed to the nas and used 'chmod -R 770 /share/external/sds1' - this granted me access to the folders, and some files. I can open all files in the root, but if I go just 2 folders 'deeper', i can't open the files in this folder, and in the folders after that.

In ssh, if i navigate to the folder wher I cannot open the files and use 'ls -l', i can see that the permissions (770) hasn't been applied to these files. How can I get chmod to apply the 770 permission to all files, folders, subfolders and files in subfolders etc., without having to chmod every folder one by one?

View 8 Replies View Related

Programming :: Downloading A List Of Files From A Remote Server Using A List?

Feb 10, 2009

I am trying to get this script to work. The purpose is to download a list of modules from the slax.org the list consist of a list of module numbers. What I am trying to do is Download the file or the file name corresponding to the number in the list.the list is comma delimited. this is what I have done so far and I am a stand still.

#!/bin/sh
# Wget script to retrieve modules from slax.org modules
#
# ----Begin of user defined values -----
# Path to wget

[code].....

View 7 Replies View Related

Programming :: Sort Files In Directories Based On Files Date

Sep 8, 2009

I need a script that will take all the files in a given directory and create new monthly sub-directories and sort all the files based on the creation date into the appropriate directory.For example, all files created between 01/01/09 and 01/31/09 will be placed in 'JAN-2009'

View 5 Replies View Related

General :: Make All Files Non-executable Recursively Using Find Without Affecting Directories?

Sep 26, 2010

I need to strip the executable flag from all files within a certain directory and sub directories. Right now I'm doing it with a 2 step process

find /dir/ -type f -exec chmod ugo-x {} ;
find /dir/ -type d -exec chmod ugo+rx {} ;

Is it possible to modify the first line so that I can strip exec flag from all non-directory files? Since this needs to be done on a fairly regular basis across a lot of directories and files, I'd prefer not to use a bash script which would slow it down.

View 1 Replies View Related

Programming :: Determine Files And Directories?

Mar 9, 2010

i made a program to list all the files in a directory,is there a way to determine what are directories and what are files ?

View 5 Replies View Related

Fedora :: Make A List Of Txt Ogg Or Other Files?

Oct 8, 2009

how to make a list of all mp3 ogg or any other files in linux and save it as csv. Or, do somebody know a program or python script which allow you to do that by just pointing at the location with this files??

View 7 Replies View Related

Programming :: How To Make List Of Thumbnails In Qt?

Aug 6, 2010

How to I make a list of thumbnails in Qt, kind of like the "Icon View" in many GUI file managers?

View 11 Replies View Related

Programming :: Copy Files To Dynamic Directories?

Feb 14, 2011

I have been searching for a solution to the following problem:

When my distro of choice updates Firefox web browser, the directory name is '/usr/lib/firefox-<version>'.
The problem here is that the directory name is dynamic by nature and doesn't allow a simple static solution, e.g.
'cp -rf /usr/local/files/bookmarks.html /usr/lib/firefox/defaults/profile'.

The same quandary applies when adding extensions, changing prefs etc.
I have looked at the following commands:-
find, sed, xargs, grep, awk, fprint.
Unfortunately my grasp of syntax and programming is very simple at best.

View 2 Replies View Related

Programming :: Cmake - Using Header Files In Higher Directories ?

Nov 1, 2010

Say I have a directory structure:

And other.c has:

How do I setup the CMakeFiles.txt files in each directory, so the executable "program" (from program.c) is created.

Currently I get the error:

View 1 Replies View Related

Programming :: Get A List Of File Install Locations With Make It?

Dec 21, 2010

I have a bit of a problem and the only solution I can think of at the moment is a very tedious one, so I was hoping there would be a better way. What I am trying to do is cross compile the PPPD program so that I can install it on an embedded system (this system does not have make/gcc on it). It was easy to cross compile it, but I can not run "make install" since I'm compiling on a secondary machine. I don't want to install PPPD on this secondary machine (I couldn't anyway, because it was compiled for a different architecture) and I can't run make install on the target machine because there is no make/build system for it.

So it seems like what I would have to do is to manually copy over each compiled file from the build machine to the appropriate location of the target machine. And the only way (that I know of) to figure out how to do this is to manually examine the Makefiles (yes, there are several for PPPD) and figure out which file should go where on the target system. This isn't trivial because it uses a hierarchy of makefiles and the probability of human error for this method is high.

Is it possible that I could run another command that would give me a list of all the commands that make install would perform? Or a list of all files and their target location for "make install"? Or possibly some other solution that I am completely unaware of that would make this task not so painful and error prone?

View 8 Replies View Related

Programming :: Moving Files To Directories Based On Part Of Filename?

Jul 6, 2010

I have a single directory of pairs of files, with the pairs sharing a string as the beginning of the filename:

SF1-27F1492R-clone01_T3_A18_001.ab1
SF1-27F1492R-clone01_T7_A20_002.ab1
SF1-27F1492R-clone02_T3_A19_003.ab1
SF1-27F1492R-clone02_T7_A21_004.ab1
...etc

I need to create a subdirectory for each pair then move the pair into the subdirectory.

I accomplished the first step using:

$find /foo -name '*T3*' -exec mkdir '{}.wrk' ;

I can use a regex to designate the pair and associate the directory, but how do I use regex in a path as the output of a move command?

View 7 Replies View Related

Programming :: Perl Script To Count Files And Directories Is Not Working?

Aug 26, 2010

I am new to perl scripting and wrote a perl script to read the directories and files and count the no of files in each directory and generate a log file. The problem is it is not printing anything to the log file. I am copying the script below.

!/usr/local/bin/perl
$dir= 'c:My ProjectsPerl ScriptsNew Folder' ;
$directory_count = 0;
$file_count=0;

[code].....

View 14 Replies View Related

Programming :: Java Preferences - Web Suggested Things Like Hidden Files Or Directories

Mar 28, 2011

I am trying to understnd where java preferences are stored based on web search I understand they are somewhat like windows registry - stored out there somewhere. web suggested things like hidden files or directories - and i've look all over th eplace withour result on Fedora 14. trying to start a program. got part way in and had given some info and then it blew. it still remembers my iput - which may have been wrong. ive looked at code and see it uses the java preferences system - wpould like to find and erase.

View 2 Replies View Related

Programming :: Shell Script To Rename All Patern Mateched Directories And Files?

Jul 11, 2011

I have one directory with 3 level sub-directories, and about houndard files under those directories. I need a shell script to rename all patern mateched directories and files.

For example: the patern is AA in the directory or file name.

View 14 Replies View Related

General :: Create A Backup Directory And 3 Directories Within That And Some Files Within The 3 Directories And Then Back Them Up Ot Restore Them?

Dec 19, 2009

i am in need of linux help. iam at college and i need this back/restore script to pass this final part of an assessment. i require a backup script that will not only backup but also restore files to the relevent directories. e.g. users are instructed to store all wordprocessor files in a directory named wp. so i am needing to create a backup directory and 3 directories within that and some files within the 3 directories and then back them up ot restore them. l know i should/have to do this myself by been trying to get/understand info for the last few days and came up with zero.

View 14 Replies View Related

Programming :: List Files In Bash + Add Url Before Them?

Dec 8, 2010

I am an uploader to a various hosts, so this tiny script me a lot. I make a rar archive and split files with 100mb. I could get 3-4 or even 76 parts of rar files and it would take me some time to paste all these urls to remote upload function of filehosting sites. For example:

Code:

server:/home/cober/downloads/teevee# ls -al
total 358784
drwxrwxrwx 2 root root 4096 Dec 8 19:38 .

[code]....

View 1 Replies View Related

Programming :: Awk - Display From The List Of Files Given As Parameters

Mar 12, 2011

I have to display from the list of files given as parameters the name of the file with the largest number of words and their number.(with AWK)

View 2 Replies View Related

Programming :: Rename Files Matching A List?

Jul 12, 2009

Is there a way, preferably in python or BASH, to rename files from a list? for instance, track1.mp3, track2.mp3 should be renamed to the names stored in a file listing song names. I have tried to loop a variable through directory listing and renamed them, only to find that filenames with spaces can't be assigned to a variable as a whole. To solve the problem above, I have tried the read command in BASH, which enables the program reading line by line from a list. However, It was failed to pipe the results from directory listing to the read command.

View 14 Replies View Related

Programming :: List Only Hidden Files In Current Directory?

Feb 15, 2010

How to list only hidden files in current directory ?

View 2 Replies View Related

Programming :: List All The Files That Don't Contain Pattern1 And Append A New String?

Mar 24, 2011

How to list all the files that don't contain pattern1 and append a new line (pattern1) to those files before pattern2 only once.

pattern1 = /var/script/showMessage.sh
pattern2 = ;;

Code:
grep -c 'pattern1' /var/script/*_cam* | grep :0 | add pattern1 before pattern2 in each file loacted before.

View 10 Replies View Related

Programming :: List Specific Files And Delete Results?

Jul 8, 2011

I ran the command:

Code:

ls -ltr | head -n40

I'd like to delete all the files listed...

View 2 Replies View Related

General :: How To Store Files / Directories In Different Different Directories?

Mar 23, 2011

I am writing a script, in that my requirement is, if all the fill types stored in one directory from that we need to separate different different directories based on the file types.

for example in a directory(anish). 5 different types files
1- directory
2- .txt files
2- .sh files

like that and my requirement is the (1- directory is moved to one new directory(dir) which we are given in the script)and (2 .txt files are moved to another new directory(test) which we are given in the script)and ( 2 .sh files are moved to another new directory(bash) which we are given in the scrip)finally the directory anish should be empty..using bash script.how it is possible !!

View 7 Replies View Related

Programming :: Bash: Populate A List Of Arbitrarily Named Files?

Mar 14, 2010

How to build a list of files under a directory that may have any permissible characters in the name, that is anything except NUL? The only possible (?) bash data structure to contain a list of such names is an array because NUL cannot be used as a list item separator so no X-separated list can safely be used; there is no "X" that might not be part of a file name. OK -- but how to populate such an array? Here's what I've tried.

Code:

#!/bin/bash
# Set up test files
dir=$(mktemp -d "/tmp/${0##*/}.XXXXXX")
touch $dir/foo $dir/bar

[code].....

View 10 Replies View Related

Programming :: C++ List Regular Files Function Failing Inconsistently?

Mar 28, 2011

I've got a problem with a piece of code. Basically, I use my listRegularFiles function in two separate places in my code. The first time I run itit appears to work perfectly well. If I use it a second time, however, it blows a gasket. I'll post my code below, and if anybody has any ideas,Here's the code for listRegularFiles:

Code:
string listRegularFiles(char* dirname)
{

[code]...

View 2 Replies View Related

Programming :: BASH Read Text List Zip Files Into A Single Archive?

Jul 22, 2010

AKA "zipping on the fly .. the slow-as-molasses way." The list includes full pathnames to each file, and they're all in subfolders of the same parent folder (which, unfortunately, is not the root folder of the drive or system on which the files reside). A cleaned-up and radio-ready portion of the list looks like

Quote:

.../taiga/ahqr-va-choyvp/bv0884-073.jpg
.../taiga/ahqr-va-choyvp/bv2635-073.jpg
.../taiga/ahqr-va-choyvp/bv3067-175.jpg

[code]....

What I'd like to be able to do is zip all the files in the list into a single archive, to avoid the step of having to copy them to the same location (presumably another folder on the HD) and then zip that folder. I'm more inclined to make provisions about extracting to a single folder at some other time. Is this possible in BASH, or would I have to consider a faster, more robust scripting language such as python or perl?

View 8 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved