directory

How can I list all files in a directory sorted alphabetically using PHP?

I'm using the following PHP code to list all files and folders under the current directory: <?php $dirname = "."; $dir = opendir($dirname); ?> <?php while(false != ($file = readdir($dir))) { if(($file != ".") and ($file != "..") and ($file != "index.php")) { echo("<a href='$file'>$file</a> <br />"); } } ?> The problem is list is not ...

Monitor directory listing for changes?

On a unix system, how do I monitor (like how 'tail' works) a directory for changes made to files - either new ones created, or size changes, etc. Looking for a command line tool rather than something to be installed. ...

Authenticating in one Domain and querying users from another in Java

Is it possible to authenticate users in Active Directory Server A, and then search for users in Active Directory Server B using java? These servers are configured to be 2-way trusted. The above code fails. I can authenticate in server A perfectly fine, but when I start searching for users in B, it returns nothing Hashtable<String, ...

php: check if path exists?

hey guys, i'm setting a path variable with a query-string. what's the easiest way to check if the path (always a directory) exists or not. if(isset($_GET['p'])) { define(PATH, $_GET['p']); so now i have like mydomain.com?p=files/folder/sub and everything works fine, i'm reading the contents of the folder. however i can pass al...

php: path in querystring - best way to prevent hacks and bugs?

hey guys, i know it's not the best way of doing this but the whole thing is just a little project which doesn't need anything more difficult. i'm passing directory names along with my url like domain.com?p=folder/subfolder/etc i'm looking for the best way to check if the dir exists and i want to (at least) kind of prevent people from ...

Is there a way to get this C# code to automatically overwrite files?

Is there a way to get this code to automatically overwrite files? // Requires project reference to Microsoft.VisualBasic using Microsoft.VisualBasic.FileIO; class FileProgress { static void Main() { string sourcePath = @"C:\Users\public\documents\"; string destinationPath = @"C:\testFolder"; FileSystem.CopyDirect...

Eclipse automatically refresh resources and exclude build dir

Eclipse Helios: 40+ project working set, using maven (mvn-eclipse plugin) to generate eclipse project files. 'Resource is out of sync with the file system: ...' Appears after doing, among other things, a text search. After a bit of googling found Prefs > Workspace > Refresh Automatically which is widely reported to be malfunctional, ...

Get the path "difference" between two directories

The situation: I got one or more absolute paths, e.g.: /home/benjamin/test/ /home/benjamin/test/a/1 /home/benjamin/test/b/1 How can I get the difference between two paths? Let's say I want to know how I can get from path 1 to path 2. Expected result would be /home/benjamin/test/a/1 - /home/benjamin/test/ = /a/1 Is there a more ele...

Calculate checksum for a directory

Hi, i need to calculate a checksum for a directory in question. It should return one number for this directory, not for each file inside it. Can you, quys, help me with it ? Thanks. ...

In C, how can I create a file from a filepath, even if the directories are not existing?

I am taking a file path from a user. I need to then access that file, and create it if it does not exist. I also need to create any intermediate directories if they don't exist as well. For example, if my directory looks like: mydir | +---subdir | | | +-- FileA | +---File1 I might receive mydir/subdir/FileA and would then access ...

How To get currently logged in Active directory user name in C#

I want to get currently logged in active directory user name/details. Here, User does log in to machine with its AD username and password. How can i get this user name and other details in Global.asax file for Application_AuthenticateRequest() Event. I have used System.Security.Principal.WindowsIdentity.GetCurrent().Name But, when i...

Switching to an aliased directory

Hello, Just wanted to know if it is possible to switch to an aliased directory using shell script. To switch to a directory there is cd command. But i have aliased the directory and wanted to know as how to switch to the aliased directory. Could someone please help me? ...

How to add a path of runtime DLL in VIsual C++ Express 2010 project?

I have some external dependencies to load with my C++ program, like boost or other libraries. If those .DLL of libraries are not in $PATH, once I run my program I got a "can't load the DLL" error message. To make those .DLL can be load when running my program, I need to add those path to libraries directory. For example: PATH=$PATH;c:\...

Represent a directory tree family-tree style

How can I output a representation of a directory tree in a family-tree style like this one where one to ten are directories at different levels under the root directory? root | ----------------------------- | | | | one two t...

Bash For-Loop on Directories

Quick Background: $ ls src file1 file2 dir1 dir2 dir3 Script: #!/bin/bash for i in src/* ; do if [ -d "$i" ]; then echo "$i" fi done Output: src/dir1 src/dir2 src/dir3 However, I want it to read: dir1 dir2 dir3 Now I realize I could sed/awk the output to remove "src/" however I am curious to know if there is a be...

I write a MySQL table into an output file (working on Unix) but I can not enter the file directory (permission denied)

When I output a whole table into an output file named 'Arshan.txt' this command works well but I can not access the output file created. When I access /usr/local/mysql/data it says permission denied. Any help will be appreciated. Thanks in advance. ...

IIS 7 settings for directories without / at the end

i searched here, but i didn't find the solution to my problem So, basically, this is what i want. I moved a website to a server that has IIS 7 installed, and now when i put in the address bar a link like: domain.com/folder , it gives me a 404 error. folder is a directory that has inside a default.aspx file. but if i put domain.com/fold...

Change the default path where the web server looks for images

Hey all, I'm trying to change the default path or add a path that the webserver looks for images. I really would really like a solution to do this in PHP and not in htaccess. The most basic example would be trying to "break" the current implementation so say I have a directory with the following: main/ image.png index.php In index...

Mysql command line restore error "The system cannot find the file specified."

Hey, Ive got a rather strange issue, ive got an automated build tool that is calling through to the mysql command line to teardown then setup a database from an SQL file. On one computer it is working fine, and its basically calling: Mysql -h {Connection::Host} -u {Connection::User} --password={Connection::Password} < {sqlFile} Ive j...

How to get direct Reports from Active Directory

It was previously asked but I won't include it for me. Here is the code I'm using to include users from active directory to MS sharepoint: private static Collection GetDirectReportsInternal(string ldapBase, string userDN, out long elapsedTime) { Collection result = new Collection(); Stopwatch sw = new Stopwatch(); sw.Start(); str...