Simply copy the entire working directory contents (including the hidden .git directory). This will move the entire working directory to the new directory and will not affect the remote repository on GitHub. If you are using GitHub for Windows, you may move the repository using the method as above. However, when you click on the repository in ...
Share, comment, bookmark or report
I don't understand why some answers are complicated. This is how I would do it with Python 2.7. Replace DIRECTORY_TO_LOOP with the directory you want to use. import os DIRECTORY_TO_LOOP = '/var/www/files/' for root, dirs, files in os.walk(DIRECTORY_TO_LOOP, topdown=False): for name in files: print(os.path.join(root, name))
Share, comment, bookmark or report
Moreover, if a package is on sys.path, but a package with same name but different directory is in sys.meta_path, Python will import from both, prioritizing sys.path. This can be troublesome if you've intentionally removed something from the package in sys.path - Python will keep importing it from sys.meta_path.
Share, comment, bookmark or report
Recursively copy an entire directory tree rooted at src to a directory named dst and return the destination directory. dirs_exist_ok dictates whether to raise an exception in case dst or any missing parent directory already exists. Therefore, with Python 3.8+ this should work:
Share, comment, bookmark or report
In the current version of PowerShell (tested with v5.1 on Windows 10 and Windows 11 in 2023) one can use the simpler Unix syntax rm -R .\DirName to silently delete the directory .\DirName with all subdirectories and files it may contain. In fact many common Unix commands work in the same way in PowerShell as in a Linux command line.
Share, comment, bookmark or report
All the previous answers are valid, but something that I don't think is mentioned is that once you add a file from that directory into the repository, you can't ignore that directory/subdirectory that contains that file (git will ignore that directive). To ignore already added files run. git rm -r --cached .
Share, comment, bookmark or report
Unlike the CMD.EXE CHDIR or CD command, the PowerShell Set-Location cmdlet will change drive and directory, both. Get-Help Set-Location -Full will get you more detailed information on Set-Location, but the basic usage would be . PS C:\> Set-Location -Path Q:\MyDir PS Q:\MyDir> By default in PowerShell, CD and CHDIR are alias for Set-Location.
Share, comment, bookmark or report
os.path.isdir("directory") It will give boolean true the specified directory is available. os.path.exists("directoryorfile") It will give boolead true if specified directory or file is available. To check whether the path is directory; os.path.isdir("directorypath") will give boolean true if the path is directory
Share, comment, bookmark or report
The question is not clear whether the current working directory is wanted or the path of the directory containing the executable. Most answers seem to answer the latter. But for the former, and for the second part of the question of creating the file, the C++17 standard now incorporates the filesystem library which simplifies this a lot:
Share, comment, bookmark or report
Since Python 3.5, you can use os.scandir.. The difference is that it returns file entries not names. On some OSes like windows, it means that you don't have to os.path.isdir/file to know if it's a file or not, and that saves CPU time because stat is already done when scanning dir in Windows:
Share, comment, bookmark or report
Comments