IIS: shortcut to folder - iis

considder this:
folder in initpub:
folder1
folder2
folder3
In folder1 I place all the files of my website.
In folder2 I place a shortcut to folder1 and add a web.config file.
In folder3 I place a shortcut to folder1 and add a slightly different web.config file.
In IIS I create an application for folder2 as well as for folder3.
Would this work?
Or is there another way to do something simulair.
Basically the only difference is in the web.config.

Related

In "sftp" how to upload all files, but not (sub)folders

In an sftp session, is there a way for me to put the contents of a folder, but only files (not subfolders)? Here's an example.
Folder
main.py
config.py
requirements.txt
__pycache__ (a folder)
Above is a sample of the local directory. From the folder that encloses Folder, I'd SFTP to the target server. How do I put only main.py, config.py, and requirements.txt (they're files not folders)? . I don't want to put __pycache__ as it's a folder.
If I put -r Folder it will copy Folder and all its contents, including __pycache__. If I put -r Folder/*, it will put all the contents of Folder, without Folder itself, including __pycache__. This is close to what I want. A variant of put -r Folder/* that only copies file contents, not subfolders. So it would skip the __pycache__ folder when copying contents.
Thanks!
Just remove the -r if you do not want to recurse into the subdirectories:
put Folder/*

how to copy files with subfolders

I have folder with subfolders and files inside. I want to copy all html files from all subfolders in main folder (parent) and have it in new folder (dist) with the same folder structure. (I am using Mac)
parent
subfolder1 - file1.html, file4.html
subfolder2 - file2.html
subfolder3 - file3.html
Expected result is dist folder with structure the same as in parent folder:
dist
subfolder1 - file1.html, file4.html
subfolder2 - file2.html
subfolder3 - file3.html
I am using this command:
cp -R ./parent/templates/**/*.html ./dist/templates
But the result is templates folder filled up with .html files but no subfolders copied.
dist
file1.html
file2.html
file3.html
file4.html
So I am not sure how to do it.
how to do it.
With GNU cp you could try:
cd ./parent/templates/ &&
cp -R --parents **/*.html ../../dist/templates
But I would recommend to use rsync.

How to rsync all folders present on the destination folder

I have two folders FolderA and FolderB as below. I want to rsync the common subfolders. For example, I can do rsync -avzP /path/to/FolderB/* /path/to/FolderA/, which will keep SubFolder1 and SubFolder3 mirrored. My question is how I can achieve the same if FolderB is the destination without explicitly --include or --exclude individual subfolders (e.g., in case there are too many of them).
FolderA
|--SubFolder1
|--SubFolder2
|--SubFolder3
|--SubFolder4
FolderB
|--SubFolder1
|--SubFolder3
You can update all files in FolderA using the contents FolderB as the source with your normal:
rsync -uav /path/to/FolderB/ /path/to/FolderA
(note: the trailing '/' after FolderB/ is mandatory to copy the contents of FolderB rather than FolderB itself)
To do it in reverse and update FolderB from FolderA and not copy SubFolder2 and SubFolder4 with the --existing option which will "skip creating new files on receiver", but that will also prevent new files and directories within SubFolder1 and SubFolder3 from being created as well.
You best option to not copy SubFolder2 and SubFolder4 while allowing new files and directories within SubFolder1 and SubFolder3 be created is to use the --filter option. See rsync(1) - Linux manual page.
A typical way to use --filter to exclude SubFolder2 and SubFolder4 on a copy from FolderA to FolderB would be:
rsync -uav --filter -_SubFolder2/ --filter -_SubFolder4/ /path/to/FolderA/ /path/to/FolderB
That will allow you to copy the complete contents of /path/to/FolderA/ to /path/to/FolderB/ without including SubFolder2 and SubFolder4.
Edit Per-Comment On Large Number of SubFolders
If you have a large number of folders under FolderA that you do not want to sync under FolderB, then your other option is to create a text file holding the absolute path to only those SubFolderX under FolderA you want to rsync to FolderB and then use the --no-R and --files-from=folderlist options to only rsync the wanted SubFolders. This will eliminate having to specify a large number of --filter options on the command line.
For example, you can create your folderlist with:
find /path/to/FolderA -maxdepth 1 -type d > folderlist
(note: specify the absolute path above and find will produce the folderlist file containing absolute paths)
Now edit your folderlist file and remove the parent directory (e.g. /path/to/FolderA) and any SubFolders you don't want to sync under FolderB. You can now use the folderlist file to control which SubFolders under FolderA are sync'ed to FolderB without having to include a long list of filters on the command line. Your command line then becomes
rsync -uai -r --no-R --files-from=folderlist / /path/to/FolderB
(note: the '/' as source serves as a base for the paths contained in folderlist. You can change the -i option to control the level of information dumped to the screen, e.g. -v, etc... or remove it altogether to suppress any reporting other than errors)
(also note: when using --files-from, -a does not imply -r (recursive), so you will need to explicitly add -r if you need a recursive transfer)

recursively move, rename and zip files

I have a folder structure like this
Folder1 Folder2 Folder3 ...FolderXYZ
Each of these Folders contains around 500 files named like
event-yyyy-mm-dd-0001.jpg_backup event-yyyy-mm-dd-0002.jpg_backup ... and
event-yyyy-mm-dd-0001.jpg event-yyyy-mm-dd-0002.jpg ....
I need to copy all *.jpg_backup files from Folder1 Folder2 ... to a new created subdirectory within a diffrent folder Folderexisting, strip the _backup from the filenames, and make a zip with all the renamed files, named after parent directory (e.g. Folder1.zip).
The script should be able to do this recursively for all folders. OS is a Debian Wheezy with no GUI.
THX in advance

how to mirror directory with htaccess?

is it possible to mirror directory with htaccess?
For example:
/folder1 <= is empty
/folder2/blah/blah <= here is content
I want folder1 to display folder2 contents. So that when you go to folder1/ you can navigate to folder1/blah/blah/files
is this possible?
Alias can do this, although folder1 shouldn't exist for it to work:
Alias /folder1 /folder2/blah/blah
In .htaccess files, you can only Alias to a directory inside the web root.
It doesn't always work in .htaccess files, depending on the server configuration.
In the central configuration, you may have to use an absolute path as the Alias target.

Resources