Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
When executing a C-program, we have to type a '.' token and a '/' token together followed by our program name:
./program
What do each of the these tokens mean? Why do they need to be together to work?
The ./ syntax just refer to the current directory (Actually . is the current directory while / is the path separator). This is needed because the shell will look into folders specified in $PATH environment variable for executables. Since the program is in the current directory which is not inside PATH by default you need to specify the folder you are running it from.
Actually, this has nothing to do with C. This value is simply passed along to the operating system and used to locate a file.
But on Windows, it doesn't appear to have much meaning at all. . is the current directory and the / is simply the path separator between the current directory and program. Since the OS defaults to the current directory, it refers to the same path as just program.
. means current path
.. means parent.
/ means root or path separator. Depends on Unix/Windows/Mac
./ means current path and relates, towards RHS.
./Program means PWD and Program as Directory or Location.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I already know what it does: It simply goes one directory or folder backwards.
But what's mysterious for me are those two dot.
cd.. #it has the same function as popd with the difference that it changes the
#current working directory
If someone tell me what is the philosophy of putting those two Dots, i would really appreciate it.
.. in filesystem paths represents a given path's parent path.
Without an explicit path preceding the .., the implied path is the current [working] directory, so the .. therefore refers to the current directory's parent directory.
In short: cd with an argument of .. changes to the current directory's parent directory, i.e., the directory one level above in the directory hierarchy.
Shell-specific use of .. with cd:
The legacy command processor, cmd.exe ("Command Prompt") - seemingly with the internal cd command specifically (see Mofi's comments on the question) - considers an . character to implicitly start the cd command's argument.
Therefore, separating the cd command from the .. argument with a space character, as usual, isn't necessary; that is, instead of cd .. you can type cd.., which is a shortcut that users of cmd.exe have grown accustomed to over the years.
PowerShell allows . characters to be used in command names, so submitting cd.. does not invoke the cd command (a built-in alias for the Set-Location cmdlet) with argument .. - instead, it looks for a command literally named cd..
To accommodate cmd.exe users who are accustomed to the cd.. shortcut, PowerShell comes with a parameter-less function literally named cd.., so that submitting cd.. as a command in PowerShell effectively works the same as in cmd.exe.
However, note that only cd.. works, not also specifying additional components; that is, something like cd..\Foo (which works in cmd.exe) fails.
Get-Command cd.. | Format-List shows information about this function, which reveals that it simply calls Set-Location .., which is PowerShell's equivalent of cmd.exe's cd ..
These two dots mean "One upper level in the directory".
cd specifies to change the directory and .. means "upper level". So, cd.. means exactly what you stated in your question.
Example: let's say you are in the folder C:\x\y. If you type cd.., you'll be on C:\x
This question already has answers here:
Access m-files in a subfolder without permanently adding it to the path
(2 answers)
Closed 7 years ago.
I'm working on a project containing some subprojects. Each subproject is located in a own folder.
projDir/subProj1
/subProj2
and so on. Each subproject is a standalone running project. But now I want to use some functions of i.e. subProj1 in subProj2. But the functions in subProj1 should not be visible in general. So it is no good idea, to add the subProj1-path to the MATLAB-Path generally. Hence, I want to add this path in my .m-file stored in subProj2 and after finishing this script, the path should be removed (automatically) by it's own. Is there any possibility, to add a path temporarily to the MATLAB-path variable?
The addpath function only adds the files/folder to your path for the current Matlab session, assuming you don't call savepath. You also might find the genpath function helpful if you want to add subfolders.
You can use path(path_to_add,path) to add a path to the current path variable. Unless you do savepath you won't affect the global path.
I would do path(strcat(pwd,'\subProj1',path) etc. in the config .m script you have.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 9 years ago.
Improve this question
Related to this -- https://stackoverflow.com/questions/21487257/a-perl-cgi-script-for-uploading-files -- question, I have another one: can this:
http://www.seaglass.com/file-upload-pl.html
script be modified so that it would accept different input files and save them as different output files, and not just overwrite the single output file?
I'm new to Perl/CGI, so I wouldn't see an obvious answer.
In $basename you already have name of the file. You do not have to write the uploaded file into /tmp/outfile; you can construct the path dynamically, depending on $basename.
Create a directory where you want to place the files. I assume it will still be C:\tmp. Instead of
open(OUTFILE, ">/tmp/outfile")
write
open(OUTFILE, ">/tmp/$basename")
and it should work. Taint is removed from $upfile inside GetBasename(), even before $basename is created. But this is not safe, still. Before giving it to open(), you should remove all unwanted characters from the file name, e.g.
$basename =~ s/[^A-Za-z0-9_.-]//g;
$basename =~ s/^[^A-Za-z0-9]*//;
If $basename is empty now, you have to chose a name other way. Also if file of the same name already exists, you have to choose whether you want to overwrite it or make up a unique name. My current solution just overwrites.
If you want to know more about regular expressions, look at perlre manual page.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I want to copy a directory(abc) from domain1/user1 to domain2/user1. any idea how to do this.
e.g robocopy
robocopy \\server1\G$\testdir\%3 \\server2\g$\uploads
and both are on different domains
Robocopy will use the standard windows authentication mechanism.
So you probably need to connect to the servers using the appropriate credentials before you issue the robocopy command.
You can use net use to do this and you could put that in a batch script.
Note that Windows doesn't like you to connect to the same server with two different sets of credentials (so you can't copy from and to the same server as different users). But that's not what it looks like you need.
Something like this:
net use \\server1\g$ /user:domain1\user1 *
net use \\server2\g$ /user:domain2\user2 *
robocopy \\server1\G$\testdir\%3 \\server2\g$\uploads
Notes:
This is using 'deviceless' connections which will not be recreated at start up (and won't appear with a drive letter in windows explorer).
The asterisk at the end of the net use command means prompt for password, you could hard code the password in there (or get it as a parameter to the script).
Might be worth reading up on net use to make sure it does what you need.
You can probably also remove the network connection to the servers by using this (I haven't tried this with a deviceless connection):
net use \\server1\g$ /delete
net use \\server2\g$ /delete
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I have some zipped plug-ins, when I try to unpack that the unpacking fails. When I looked deep into it I found that the some of the files are exceeding 256 characters, which I guess is not allowed in WINDOWS operating system.
So my question is there any way to find out if any file name inside a particular folder exceeds 256 characters?
I'm using WINDOWS XP operating system.
Thanks in advance!!
Anand
Without having your zip file is a bit harder to find out if the problem is exactly what you said... AFAI remember, 7zip would truncate the long file names, not "not extract" them. But I don't have any zip with long names to test.
I'd try some things:
Open the zip file with 7zip and try to rename the long names, instead of extracting them.
Try to open the zip file with other zip app, like (izarc)[http://www.izarc.org/news.html], and rename the files
If you don't have access to another computer, try to use one of the available online unzippers. For example: http://jcarleemae.wen.ru/extract.html