directory

Removal after some Iterations: yes | rm -r .git

I need to kill the "yes" command after some iterations, two methods: a) kill it b) give "n" as an input after some time How would you automate the removal of .git directory? ...

Checking for directory and file write permissions in .NET

In my .NET 2.0 application, I need to check if sufficient permissions exist to create and write to files to a directory. To this end I have the following function that attempts to create a file and write a single byte to it, deleting itself afterwards to test that permissions do exist. I figured the best way to check was to actually try...

How should I install more than one version of Perl?

I want to install, from source, Perl versions 5.005, v5.6, v5.8, v5.10 Right now I have 'v5.10.0' installed. /opt/perl/bin /opt/perl/html /opt/perl/lib /opt/perl/man /opt/perl/lib/5.10.0 /opt/perl/lib/site_perl /opt/perl/lib/site_perl/5.10.0 Will I have any problems if I install them all in /opt/perl? Or should I split them up in...

Batch/CMD: Finding out every single folder file meta.xml

Hello, i have a directory which contains the following: -directory -another directory -meta.xml -yet another directory -meta.xml ... So it needs to find in every directory 'meta.xml', all by itself (so that i dont have to type in every directory at the code) And i want that with EVERY meta.xml file a command is done. Is there ...

Is there any way to change directory using C language?

Is there any way by which I can change to any directory by executing a C program? ...

In java: Take snapshot of a directory and restore it

Is there a library to take a folder, take a snapshot of its content, do some modifications and then restore it to its previous state from directly from a java program (i.e. not from the command line) ? Edit: Basically, i am working on a very large folder: 80mb, ~7000 files. And I want to restore only files that were modified as fast as ...

Reorganize folders with a script

Hi, Through the last years I have different types of software to organize my photo and music collections. This has resulted in differences in directory structure, and I'd like this to be uniform. Problem a: Music collection I want my music collection to look like: /Artist/Album/files.* but now there are several instances of /A/Artist/...

Batch: Do what ThinApp does

Hello, i want my batch file to do something like VMWARE's ThinApp Setup Capture does. So, this is what it basically needs to do: first run a total computer scan at any files, folders, register keys etc, and make a total list of them. after the user wants, it will do everything again and check for the differences between those two lists...

Securely enforcing user-inputted file paths within subdirectories

I know the solid security recommendation of avoiding accepting user input that you then use to choose a path to read/write a file. However, assuming you have a base directory you want to keep within (such as the root of an ftp folder), how do you best ensure that a given user input keeps us within that folder? For instance, Path.Combi...

PowerShell analog to "dir /a:d" (Win) or "ls -d */" (Bash)

I simply want to list all of the directories under my current working directory, using PowerShell. This is easy from a Bash shell: ls -d */ or cmd.exe in Windows: dir /a:d Using PowerShell however I cannot seem to be able to do it with a single command. Instead the only the I've found that works is: ls | ? {$_Mode -like "d*"} Th...

Navigating and Determine full path in FInder save-as dialog Mac OS X

How do you navigate the directory structure in a save as dialog on Mac OS X (Finder). Can Apple really have botched the simple funcitonality? ...

How to download files from internet and save in 'Documents' on iPhone?

I have a folder on my remote server that has a few .png files in it. I want to download these from within my app and store them in the apps 'Documents' folder. How can I do this? ...

Using FTP how do I rename a directory with trailing spaces?

I have a directory on my website the has two trailing spaces (automatically created) and now I need to rename it to the same name with out the spaces. For example: ren "BON N ALL " "BON N ALL" But I keep getting; ftp> ren "BON N ALL " "BON N ALL" 550 BON N ALL : The system cannot find the file specified. I've tried using wildcar...

How to [recursively] Zip a directory in PHP?

Directory is something like: home/ file1.html file2.html Another_Dir/ file8.html Sub_Dir/ file19.html I am using the same PHP Zip class used in PHPMyAdmin http://trac.seagullproject.org/browser/branches/0.6-bugfix/lib/other/Zip.php . I'm not sure how to zip a directory rather than just a file. Here's what I hav...

ASP.NET C# - Create upload directory on the fly?

public class UploadHandler : IHttpHandler { public void ProcessRequest(HttpContext context) { ... // Create the directory if needed... if (!Directory.Exists(uploadDir)) { System.Security.AccessControl.DirectorySecurity ds = new System.Security.AccessControl.DirectorySec...

writing image to directory fail

Hi, Some overflow runtime error happens when my C++ program is trying to write some .png images into a directory. The directory where the images are written into is given as a command line argument. The program is compiled with gcc -ggdb3 -O3. It is strange that the error disappears if I change the directory to another one when rerun...

PHP File Directory - $_SERVER['DOCUMENT_ROOT']'s parent folder

I know $_SERVER['DOCUMENT_ROOT'] returns the document root (most likely something like /home/user/public_html), but is there any way to get the parent directory of this folder? (i.e. just /home/user/) I would try and replace common folder names like public_html or www, but it's not a given that the folder would be named that on all syst...

c++ how to create a directory from a path

hello, what is a convenient way to create a directory when a path like this is given: "\server\foo\bar\" note that the intermediate directories may not exist. CreateDirectory and mkdir only seem to create the last part of a directory and give an error otherwise. the platform is windows, MSVC compiler. thanks! ...

specify directory for C++ object files and executable in Makefile

Hi I am using gcc -MM to generate prerequisites of dependencies rules for compiling source files into object files. I want to specify a directory to hold object files and executable in the value of some variable BIN_DIR=bin/release/. There are two cases: CASE 1 %.d: *.h *.cc Makefile @$(CXX) -MM $(CXXFLAGS) *.cc > $@.$$$$; \ ...

Hide folders with .htaccess

Is it possible to hide the folders in my root folder? Just in case my index.php would disappear you know? Could I also show 404 error not found if someone requests them? ...