w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to access a file in a directory from other directory, when both are in same parent directory with HTML
if dir1 and dir2 are in the same parent directory then this is how you access 2.html from 1.html: <a href="../dir2/2.html">link to 2.html</a> hope it helped :)

Categories : HTML

Ruby: correctly load a file in parent directory, which file depends on another file
In file b.rb: require_relative "./a.rb" def f2(v2)...... See http://extensions.rubyforge.org/rdoc/classes/Kernel.html

Categories : Ruby

Call upon a file to destroy itself along with its parent directory?
On a unix-based system: definitely. Use rmdir and unlink. Windows systems tend to lock files that are currently open, so this may not work (although I can't be certain). Of course, your webserver needs to have full write permissions to the folder, as well as to its parent-folder.

Categories : PHP

verify presence of file in parent directory
Use os.path.exists, the problem with your code is os.path.join(os.pardir + '/foo') is always going to be True as a boolean value of a non-empty string is True. if os.path.exists(os.path.join(os.pardir, 'foo')): print "true" else: print "false" help on os.path.exists: >>> print os.path.exists.__doc__ Test whether a path exists. Returns False for broken symbolic links

Categories : Python

File I/O not working if parent app launched by app in a different directory
lpDirectory optional argument of ShellExecute function allows client to specify a working directory for the program to be executed.

Categories : Delphi

Get parent directory and modification date from a file using Powershell
I wouldn't put them into separate variables. I'd just select the 2 properties: $files = Get-ChildItem –Recurse | ? { -not $_.PSIsContainer -and $_.LastWriteTime -gt "7/1/2013" -and $_.LastWriteTime -le "7/22/2013" } | select Directory, @{n='LastWriteDate';e={Get-Date -uformat "%m/%d/%Y"}} Then you can access those values like this: $files[0].Directory.FullName $files[0].LastWriteDate

Categories : Powershell

RewriteCond checking file existence on parent directory
You can put your rules in a htaccess file in your top directory; this way, if you have /parentdir /en /es /de even if you access the parent path or the child paths: /parentdir/products.php /parentdir/en/products.php the /parentdir/.htaccess rules are evaluated So you can use a ruleset like this: # check if requested file does not exists in the child dir # check if requested file does not exists in the child dir # if does not exists... check if it also does not exists in the parent dir RewriteCond /parentdir/$1/$2 !-f RewriteCond /parentdir/$2 !-f RewriteRule ^/parentdir/(es|en|fr|de)/(.*)$ contentpage.php?url=$2&lang=$1 # check if requested file does not exists in the parent dir RewriteCond /parentdir/$1 !-f RewriteRule ^/parentdir/(.*)$ contentpage.php?url=$2

Categories : PHP

Including a file in an included folder's parent directory fails
The relative paths are always interpreted from the current working directory (usually referred to as CWD). With web requests this is usually the file's directory that got the request to handle, but can be changed any time with chdir(), you can check it's current value with getcwd(). If you want your code to be resilient against the cwd, you can use the __DIR__ magic constant or if you are on an ancient php version (before 5.3) the dirname(__FILE__) in your includes, like this: require_once __DIR__.'/../DB.php';

Categories : PHP

R Split character vector of file paths into list by parent directory?
You could combine split and dirname: path <- c("/home/username/data/dir/GCZ98/GCZ98_1998_12_16.asc.gz", "/home/username/data/dir/GCZ98/GCZ98_1998_12_20.asc.gz", "/home/username/data/dir/GCZ99/GCZ99_1999_12_21.asc.gz", "/home/username/data/dir/GCZ99/GCZ99_1999_12_23.asc.gz", "/home/username/data/dir/GCZ99/GCZ99_1999_12_27.asc.gz", "/home/username/data/dir/GCZ99/GCZ99_1999_12_28.asc.gz") ## split by basedir split(path, dirname(path)) # $`/home/username/data/dir/GCZ98` # [1] "/home/username/data/dir/GCZ98/GCZ98_1998_12_16.asc.gz" "/home/username/data/dir/GCZ98/GCZ98_1998_12_20.asc.gz" # # $`/home/username/data/dir/GCZ99` # [1] "/home/username/data/dir/GCZ99/GCZ99_1999_12_21.asc.gz" "/home/username/data/dir/GCZ99/GCZ99_1999_12_23.asc.gz"

Categories : Regex

Python joining current directory and parent directory with os.path.join
You can use normpath, realpath or abspath: import os goal_dir = os.path.join(os.getcwd(), "../../my_dir") print goal_dir # prints C:/here/I/am/../../my_dir print os.path.normpath(goal_dir) # prints C:/here/my_dir print os.path.realpath(goal_dir) # prints C:/here/my_dir print os.path.abspath(goal_dir) # prints C:/here/my_dir

Categories : Python

Get parent directory's parent directory name in java
Have a look at http://developer.android.com/reference/java/io/File.html#getParentFile() Applying this twice will probably get you the right directory. But note that you program might or might not be allowed to go there, based on the settings in the file system and the context your code runs in.

Categories : Java

Convert a struct to bytes, save to file and read back to struct by another application in C#
You do realize that double[], being an array type, is a reference type? The struct holds the long followed by a reference to the heap object. That would be the reason why it doesn't work, I think. I believe you should simply write the elements of your array to a binary writer.

Categories : C#

How to redirect all sub-directory pages to parent directory?
Add this to your .htaccess file RedirectMatch 301 ^/folder/$ http://example.com/folder What this basically does in corresponding to your question is redirect anything (be it sub directories, or files) inside the folder directory to your parent folder.

Categories : PHP

How to print the name of my current directory's parent directory
You can use ${PWD%/*}: $ echo $PWD /home/me/test/t $ echo ${PWD%/*} /home/me/test As the expression ${string%substring} Strips shortest match of $substring from back of $string (reference).

Categories : Shell

not found [No such file or directory] error, even though the file present in that directory on RH Linux 6.2
Enter this: ls -ls /data/RAIL/rpo402/db/upgrade List the output for the file and look at it's permissions. Make sure the file isn't empty. Make sure the file has permissions to be executed as a shell. chmod +x upgrade_db.ksh Look at the first line of the file, make sure it has a proper header for a shell script. Maybe Korn Shell requires the shell declaration in the header. Check dmesg to see if there are any error messages, perhaps the file system and check inodes.

Categories : Linux

Parent directory in R
I assume you mean parent directory of R's working directory? The simplest solution is probably as follows. wd <- getwd() setwd("..") parent <- getwd() setwd(wd) This saves the working directory, changes it to its parent, gets the result in parent, and resets the working directory again. This saves having to deal with the vagaries of root directories, home directories, and other OS-specific features, which would probably require a bunch of fiddling with regexes.

Categories : R

Javascript Parent Directory
The key thing is to remember what the browser's view of the hierarchy is: Assuming localhost/mydomain is the root of your site, then: ...a page like localhost/mydomain/somepage.php: will appear at e.g. http://example.com/somepage.php from the browser's POV and can use pics/somepic.jpg or /pics/somepic.jpg for the pic. ...a page like localhost/mydomain/somepages/somepage.php: will appear at e.g. http://example.com/somepages/somepage.php from the browser's POV and can use ../pics/somepic.jpg or /pics/somepic.jpg for the pic. Assuming localhost is the root of your site instead, then: ...a page like localhost/mydomain/somepage.php will appear at e.g., http://example.com/mydomain/somepage.php from the browser's POV and can use pics/somepic.jpg or /mydomain/pics/somepic.jpg for the

Categories : Javascript

Moveuploaded files function in PHP moves the file to the temp directory but not to the destination directory
First time you called move_uploaded_file() you moved that file from temporary folder to $workDir. After that, uploaded file no longer exists in temporary directory. Just use rename() function to move that file from $workDir."/".$tmpName to final destination. // moves file from workdir to final destination rename($workDir."/".$tmpName, $_POST['filetype'].'/'.$rightname);

Categories : PHP

Redirect all requests to a directory and it's subdirectories to a file inside the directory, using Apache2 server
Place an .htaccess inside project one folder with the following rule: Options +FollowSymLinks -MultiViews RewriteEngine On RewriteBase /php/projectone/ RewriteRule ^(view/)?index.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . view/index.php [L] And you can repeat that for any other project folders you have. by changing the RewriteBase.

Categories : PHP

Can't read file content from a directory created by CREATE DIRECTORY statement
Possibly been overthinking this... the bfile example should have indicated what's happening, but this assumes that your original question is slightly wrong and you're actually seeing: XML_DATA -------------------------------------------------------------------------------- (XMLTYPE) The type being shown in brackets for both queries suggests you're running this in SQL Developer; SQL*Plus hows the actual text rather than the type. If that is the case, to show the contents you can use the GETSTRINGVAL method: SELECT XMLTYPE(bfilename('TMP', 'tmp.xml'), nls_charset_id('UTF8')).getstringval() xml_data FROM dual; ... or if the XML is more than 4000 characters the GETCLOBVAL method. If you're inserting the value i

Categories : Oracle

Why is directory name which contains dot(s) in the end is treated as a directory even if doesn't exists using File object in Java?
This is unrelated to Java, it's a Windows thing: Trailing dot(s) are removed from file and folder names. Even C/C++ programs can't do it. As a workaround, try to use the prefix \?: File dir = new File( "\\?\" + path ); But this will disable a lot of other things like relative paths and slash conversion. Related answers: How to create a filename with a trailing period in Windows? MSDN Naming Files, Paths, and Namespaces Why doesn't Explorer let you create a file whose name begins with a dot?

Categories : Java

Copy files from source directory to target directory and exclude specific file types from specified directories
This is one way to do it $SourceDirectory = 'C:Source' $DestinationDirectory = 'C:Destination' $ExcludeExtentions = '*.txt*', '*.xml*' $ExcludeSubDirectory = 'C:Sourcead_directory1', 'C:Sourcead_directory2' Get-ChildItem $SourceDirectory -Recurse -Exclude $ExcludeExtentions | Where-Object { $ExcludeSubDirectory -notcontains $_.DirectoryName } | Copy-Item -Destination $DestinationDirectory Your best friend here is Where-Object, or where. It takes a scriptblock as parameter and uses that scriptblock to validate each object that goes through pipeline. Only objects that make script return $true are passed through Where-Object. Also, take a look at the object that represents a file you get from Get-ChildItem. It has Name, Directory and DirectoryName containing pieces of file's FullNam

Categories : File

Cannot upgrade SVN - Can't open directory ./svn/text-base No such file or directory
I had this problem too, and svn cleanup didn't help. What I wound up doing was creating all the directories it complained about not finding (just a plain mkdir, nothing else), then running svn upgrade. That seemed to work. I switched to Git years ago, but this is a legacy project. I forgot how much Subversion annoys me by comparison. :P

Categories : Svn

Is it a good practice to have two views file? One in the website directory and one in the app directory
It is better to make views as a package and then put the two files in there. Example - myapp/ - views/ - __init__.py - first.py - second.py and in __init__.py from .first import A, B from .second import C, D Nothing stops you from having 2 view files, but it becomes very unmanagable after a while. By creating a package, you have all views related code at one place, and easy to extend if need be.

Categories : Django

What errors do I have in my php code to create a new directory and then save a file in that new directory
Compare, what you assign to $dirStructure and $file. You can notice lack of leading / in fopen parameter. Nevertheless, echo('folderName/'.$trimmedInputA.'/'.$trimmedInputA.$inputB.$inputC.$inputD.'.csv'); would certainly help you to debug.

Categories : PHP

How to redirect url to parent directory with url rewriting
Enable mod_rewrite and .htaccess through httpd.conf and then put this code in your .htaccess under DOCUMENT_ROOT directory: Options +FollowSymLinks -MultiViews # Turn mod_rewrite on RewriteEngine On RewriteBase / RewriteRule ^portfolio/(.*)$ /$1 [L,R=301,NC]

Categories : PHP

mod_rewrite htaccess parent directory
Looks pretty close. Can you this code instead: Options +FollowSymLinks -MultiViews RewriteEngine on RewriteBase /users/prp/ RewriteCond %{HTTP_HOST} !^intranet [NC] RewriteRule ^(.*)$ http://intranet/$1 [L,R=302,NE]

Categories : Htaccess

jQuery/JS: Get current URL parent directory
Fiddle var a = "http://www.site.com/example/index.html"; var b = a.substring(0, a.lastIndexOf('/'))+"/";

Categories : Javascript

Is there a way to use a pointer to struct inside the struct without naming the struct?
It is not possible to do what you are doing. The compiler has no idea what dll_node is as it determines the amount of bytes the structure will require when allocated. Do this: struct node; typedef struct node dll_node; struct node { dll_node *next; dll_node *prev; size_t elem_size; void *data; }; ... or a method I personally like to use (as you are often dealing with pointers to structs): struct node; typedef struct node *dll_node; struct node { dll_node next; dll_node prev; size_t elem_size; void *data; };

Categories : C

How to add a file thats copied from one directory to a folder in another directory thats incremented
I would recommend using time stamps rather than sequential numbering. Also here is everything in one command and it is user independent. @xcopy "%LocalAppData%GoogleChromeUser DataDefaultookmarks*" "%UserProfile%DesktopBackup of Bookmarks\%Date:~10,4%-%Date:~4,2%-%Date:~7,2%" /I /Y This will copy both the bookmarks and bookmarks.bak file to a time-stamped folder inside the Backup of Bookmarks folder.

Categories : Batch File

git move file and directory into a sub-directory along with commit history
To add to bmargulies's comment, the complete sequence is: mkdir -p x/p/q # make sure the parent directories exist first git mv x/* x/p/q # move folder, with history preserved git commit -m "changed the foldername x into x/p/q" Try it first to see a preview of the move: git mv -n x/* x/p/q Wolfgang comments: If you're using bash, you can avoid the issue of trying to move a folder into itself by using an extended glob like so (using the shopt built-in): shopt -s extglob; git mv !(folder) folder

Categories : GIT

Why is .. (the parent directory) shown in my svn status -u output?
Simple answer to my question: it's not! I've just discovered a directory called ..^M (where ^M is the newline character). I've no idea where this came from, but that was what was being shown in the output; it's just that the svn command doesn't escape or encode non-printable characters in its output.

Categories : Svn

asp.net app in virtual directory to look for bin folder in parent website in iis7
Few solutions: 1) Create symbolic link 2) Install DLLs into GAC Hope these help!

Categories : Asp Net

Find file within directory and delete the directory its in
%~dp1 can be used to convert a file param to a drive and path. Quote the output as it doesn't convert to 'safe' path names. SS64 is a great resource for learning command scripting.

Categories : Batch File

input file in directory which is not in same directory as script being run
You could add code like this to your module1: if __name__ == '__main__': import os calc(os.getcwd()) Since you can import the module from anywhere, if you now do python -m module1 then the __main__ code will run in that directory.

Categories : Python

create a tar.gz of a directory and clean up the directory except a file?
This should work: tar -zcvf dir.tar.gz --exclude="*.gz" ./dir/. && find ./dir/. ! -name "*.gz" -exec rm -rf {} + Test: $ tree -if . . ./dir ./dir/dir2 ./dir/dir2/file3 ./dir/file1 ./dir/file2 ./dir/myfile.gz 2 directories, 4 files $ tar -zcvf dir.tar.gz --exclude="*.gz" ./dir/. && find ./dir/. ! -name "*.gz" -exec rm -rf {} + ./dir/./ ./dir/./file1 ./dir/./dir2/ ./dir/./dir2/file3 ./dir/./file2 rm: cannot remove `.' or `..' $ tree -if . . ./dir ./dir/myfile.gz ./dir.tar.gz 1 directory, 2 files

Categories : Linux

How to copy/cut file(s) from one directory and sub directory and paste into another
Here you can find everything you need: http://docs.python.org/3/library/shutil.html Copying whole directory: shutil.copytree(src, dst, symlinks=False, ignore=None) Deleting whole directory: shutil.rmtree(path[, ignore_errors[, onerror]]) Moving directory: shutil.move(src, dst) Example code, that does what you want: import shutil shutil.copytree("C:UsersDesktop est", "C:UsersDesktop ew_test")

Categories : Python

How to copy file from directory to another Directory in Java
Use Apache Commons FileUtils FileUtils.copyDirectory(source, desc);

Categories : Java

jQuery prop parent checkbox from directory listing pulled from PHP
This will: Un/check all children Check all parents Uncheck direct parent if all siblings are also unchecked Fiddle: http://jsfiddle.net/a7WDk/1/ $('input:checkbox').on('change', function() { var $this = $(this), $lis = $this.parents('li'), $parents = $lis.find('> span > input:checkbox').not(this), $children = $lis.eq(0).find('input:checkbox').not(this), $related = $lis.eq(0).siblings().find('input:checkbox'); if($this.is(':checked')) { $parents.add($children).attr('checked', 'checked'); } else { if($children.length) { $children.removeAttr('checked'); } if($related.length && !$related.is(':checked')) { $parents.eq(0).removeAttr('checked').trigger('change'); }

Categories : PHP

Does fsync of a parent directory guarantee synchronization of meta data of all recursive sub directories?
When fsync is called on a directory the operation treats its target more like a file than a container of files. From the file system's perspective a directory is a special kind of file that just happens to contain metadata about other files. When fsync is applied to a directory, this metadata about the contained files is synchronized but not the subdirectories/files themselves. If you want to ensure that all of the contents are properly synchronized, then you should fsync them explicitly.

Categories : Android



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.