All Questions
10 questions
0
votes
0
answers
29
views
Dirname doesn't follow command till the end of the path
I want to use dirname to specify my root directory, but it always stops specifying the folder one before the final folder.
I want to set my working directories and have done so in the beginning of my ...
0
votes
2
answers
137
views
How can i check if a directory exists with wildcars inside an if exist and copy this folder to another location?
I am trying to write a bat script in order to better organize my clients' files.
I have created two folders.
The first one is named "folders" and contains the folders for each client with their files....
0
votes
2
answers
435
views
check last modified file in directory
My script to check the last modified file in this directory /var/spool/gammu/inbox/
#!/usr/bin/perl -w
use strict;
use warnings;
chomp (my $dirname ='/var/spool/gammu/inbox/');
my $newest_file = do {
...
3
votes
2
answers
2k
views
dirname equivalent in Go
I'm studying Go, I don't know if I missed something, but after searching, I wonder: Does dirname in NodeJS have an equivalent in Go? How to get current directory in Go code, or I have to implement one?...
0
votes
0
answers
33
views
os.walk - counting the directories traversed
I have written a code to traverse directories using the os.walk to search for a specific type of file.
for dirpath, dirnames, files in os.walk(directory):
for name in files:
if ...
24
votes
7
answers
83k
views
How-To get root directory of given path in bash?
My script:
#!/usr/bin/env bash
PATH=/home/user/example/foo/bar
mkdir -p /tmp/backup$PATH
And now I want to get first folder of "$PATH": /home/
cd /tmp/backup
rm -rf ./home/
...
0
votes
3
answers
450
views
PHP dirname() drops entire path
I have a variable $path which contains the full path to a file on a Windows network (e.g. R:\somedir\otherdir\lastdir\some.file.ext)
when I use:
$location = dirname($path);
here, $location only ...
356
votes
14
answers
384k
views
Getting the parent of a directory in Bash
If I have a file path such as...
/home/smith/Desktop/Test
/home/smith/Desktop/Test/
How do I change the string so it will be the parent directory?
e.g.
/home/smith/Desktop
/home/smith/Desktop/
1
vote
1
answer
286
views
Finding Directory Name in other directory with PHP
I have a file which name is load.php near index.php in root folder. So i only have two files in root. I like clear works like most.
Today i needed to define directories in one file name is define.php....
104
votes
11
answers
187k
views
Getting a directory name from a filename
I have a filename (C:\folder\foo.txt) and I need to retrieve the folder name (C:\folder) in C++. In C# I would do something like this:
string folder = new FileInfo("C:\folder\foo.txt")....