Tag Info

Hot answers tagged

13

Use find to select the directories and wc to count them. find <directory> -mindepth 1 -type d | wc -l


7

If you're installing X or Y, and it's not a standard OS package, then stuff should end up in /usr/local/bin, /usr/local/lib/, etc. The Filesystem Hierarchy Standard and Linux Standard Base is probably a good place to start if you want to reference the closest thing there is to a standard list.


6

Microsoft added Symlink support in Windows Vista, which should work here. You'll need to use the mklink command line tool to do this: MKLINK [[/D] | [/H] | [/J]] Link Target /D - Creates a directory symbolic link. Default to file symbolic link. /H - Creates a hard link instead of a symbolic link. /J - Creates a Directory Junction. Link - Specifies the new ...


5

This is well defined by the File System Hierarchy Standard (FHS). Wikipedia Link FHS Website


5

#!/bin/bash for f in $( ls /home/ ); do chown -R $f:yourgroup /home/$f done There is no sanity checking in this and I wrote it without any testing, so be careful. (BTW, the requirement of "no hidden files or folders" will be met by the fact that a hidden file in Unix is just a regular file with a . before it, and .username will not be a valid user for ...


5

I have to give Kyle Brandt complete credit above. So, if you like this answer below, click the Up triangle on his post to lift his status, please. However, I improved upon his routine and felt it my duty to post it here and mark it as the final answer. All I added to Kyle's routine was ensure that we're only touching the home dir, thus the line with the ...


5

These directories are created by the windows update service. The service usually extracts the updates in the drive with the most free space. As far as I know you can safely remove the directories if you're able to. In most cases you can't just delete the directories because the permissions are wrong and you first have to set the correct permisisions.


5

You should consider leaving the existing structure intact, as links (and references to files and folders in existing documentation) will be invalidated if things get moved around. I'd recommend ghettoizing that whole tree into something like an /oldstuff folder, and use some indexing/searching software to build a search engine for it instead. You can ...


5

You can use: rm -r MYFOLDER/{.[^.],.??*} This deletes also the hidden files and folders. If you have too many files in the MYFOLDER directory, then you should run instead: ls MYFOLDER/{.[^.],.??*}|xargs rm -r


4

Each distro may have their own quirks, but the overall file system structure should be more or less the same: "Linux File Structure" is a good overview of the directory structure. "Linux's directory structure" is a bit more verbose and goes into more detail about their contents.


4

Don't put wildcards in the folder parameter. Put them in the path parameter. find /www -maxdepth 2 -path '*-aws/*' -exec cp -frt /www/mainhost/aws/awstatstotals/tmp/ {} +


3

I think the way you are asking is kind of backwards. You don't want to take each folder and then find the user, rather you want to take the user and find their home folder. #!/bin/bash while IFS=':' read -r login pass uid gid uname homedir comment; do echo chown $uid:$gid "$homedir"; done < /etc/passwd You will need to remove the echo of course ...


3

To increase the security of your files you can put them in a directory outside the webroot, and then stream them to your webpages via a script. On top of this, the script that streams them has to be on an access controlled page. You can use .htaccess but I prefer a more flexible login system.


3

mv -v -f ${srcDir}${prefix}* -t $archiveDir in this case if you quote, * will be interpreted literally


3

For your linux server you can use inotify-tools based on inotify. For your windows server I haven't a solution.


3

Erm...is this a trick question, it looks kinda straightforward? if not then perhaps try the following in a batchfile somewhere in your path; md _Documentation md _ProjectManagement md Releases md Source md Source\Trunk md Source\Trunk\Library md Source\Trunk\Projects md Source\Trunk\Tests Best of luck.


3

One way is to open the list of names in word and do copy and replace. Replace ^p with ^pmkdir this will replace all carraige returns (^p) with a carriage return and the mkdir command. Then save it as a bat and run it. There's def a cleaner way to do this if its going to be used over and over, but this is quick quick.


3

inotifywait will do recursive checks. It's in the Ubuntu repositories.


3

The perfect tool for this job is using the inotify kernel service. You can use them on a shell script with the package inotify-tools (debian/ubuntu). You can read more and see some examples on the project's page. There's even an example on the page that seems to do something close to what you want: #!/bin/sh # get the current path CURPATH=`pwd` ...


3

This might help #!/bin/bash for file in `ls -a | grep -v '^\.'` do if [[ -d $file ]] then fowner=`ls -ld $file | nawk '{print $3}'` fgroup=`ls -ld $file | nawk '{print $4}'` chown -R $fowner:$fgroup $file fi done


3

I use /usr/local for stuff I put into the system, and I let third-party installers take /opt.


2

rsync will check the directory tree for changes and copy only the changed files if you give it a directory as the source.


2

Put your files in sub folders.


2

you can use chgrp -R folder That will change the group owner recusively in folder , and sub-folders, and their respective files


2

g+s adds the "setgid" bit which basically only affects the default behavior of creating new files. (in short... any new files/directories created will have the group set to the group of the parent folder) you could simply chgrp group-name some_directory/* -R to change the group of the files under "some_directory" to "group-name" recursively (-R)


2

Server specifications are likely to be less of an issue than the file system you are using. Different file systems have different approaches to storing directory data. This will impact the scanning speed at various sizes. Another important consideration is the lifecycle of the files. If you have frequent addition and deletion of files you may want the ...


2

This is a program dot_deltree.cs in C# which deletes directory trees of any depth. It works by first moving too deep directories to random name in the most shallow directory. using System; using System.IO; public class dot_deltree { public static void Main(string[] args) { if ( ! (args.Length == 1) ) { ...


2

You need a client that can handle this. lftp (mirror -R , see http://www.russbrooks.com/2010/11/19/lftp-cheetsheet ) and ncftp (put -R) are two.


2

Here you go: for /f %d in (listfiles) do md %d This makes a directory under the current directory for each line in a file called "listfiles" in the current directory. If you saved the file as a .txt file, make sure to reflect that in the command. for /f %d in (listfiles.txt) do md %d



Only top voted, non community-wiki answers of a minimum length are eligible