directory

is_dir and if else outputting syntax error, unexpected T_ELSEIF

Hello everyone, I am having some trouble with an if, else and is_dir; I am trying to create a small script that tells me if the input is a folder or a file, I have looked at: http://us2.php.net/manual/en/function.is-dir.php for a few examples, and none of them seemed to resemble mine, I read a bit on if and else as well, and it looks li...

How to retrieve file names and subdirectory names from a directory in C?

Ok I have something like this: struct dirent *dp; DIR *dir; char fullname[MAXPATHLEN]; char** tmp_paths = argv[1]; //Not the exact code but you get the idea. ... while ((dp = readdir(dir)) != NULL) { struct stat stat_buffer; sprintf(fullname, "%s/%s", *tmp_paths, dp->d_name); if (stat(fullname, &stat_buffer) != 0) ...

Adding full directory via diff & patch

Hi. Is it possible to add a full directory via diff and patch? It seems as very convenient way to add additional modules on top of standard code-base. I googled for some solutions, but they generally work on file level, not on directory level. Thanks. ...

How can I create a directory with the 'right' permissions using Perl's mkdir?

I need help with this program. As a part of my project I need to create a directory. I was using the system function to do this, but later was told that Perl has a builtin called mkdir. I'm on Ubuntu 10.04. The problem is mkdir does not seem to work as needed. It creates the directory but the permissions are different. Here is my fun...

How to reliably open a file in the same directory as a Python script

I used to open files that were in the same directory as the currently running Python script by simply using a command like open("Some file.txt", "r"). However, I discovered that when the script was run in Windows by double-clicking it, it would try to open the file from the wrong directory. Since then I've used a command of the form ope...

Can't access "/conf" and other folders with ftp (filezilla)

How do I access folders such as /conf, /usr/bin, /var with ftp? I want to be able to edit the files in them using a program like filezlla I heard it had to be done with vsftpd, can someone explain more about that -and using filezilla sorry if it sounded stupid ...