Is there any way I can be prompted on keeping or replacing files when they're attached to pages I'm importing?
I reuse a lot of assets between my various courses, but I also update my pages regularly. Sometimes when I update a page in Course A, I'll delete old versions of that page from Courses B and C, then send the updated page from Course A to the others. This works perfectly in terms of keeping all the internal links stable. (Since the originals in B and C were deleted, the new page from A can keep its original name, and the internal links will continue to point to the updated page.)
However, the problem comes in when I have any files attached to those pages. Let's say X.jpg is on the page. When I send it to the other courses, it becomes X-1.jpg. Both files exist in the Files portion of my course.
I can go through files and delete al the duplicates, but all that does is make it so I have dead image links and file downloads throughout. I then have to manually go back and restore images and files.
Is there some box I need to check in settings that will make it so Canvas will check to see if I have identically-named files or other assets when I'm importing pages, then prompt me as to whether I want to replace, rename, or cancel the upload of that duplicate file?
When searching through the forums, I found numerous pages telling me that uploading files directly into the files page will give me such a prompt. But that process doesn't get a look in on page importation.
Solved! Go to Solution.
I think what you are seeing cannot be change (unfortunately).
The way around it is to delete the files in the course you are importing into first and then do the import. Then when the import occurs you don't get the -1 added on.
Fortunately you can highlight multiple files and delete them at the same time (use the ctrl and click on individually - or click and then shift click to delete a block of files).
Not the ideal case, but at least you would not have to delete them 1 at a time.
Still more work than a nice question box that says a file with "name" already exists overwrite or create file name-1 (and then the do this with all other occurrences as well)
As an update, I was able to get the editing to work eventually. What I had overlooked is that the file is named twice, once in an "src" tag, and once the "data-api-endpoint" tag. I think the reason my changes were reverting was because I was only changing one of them, not both.
Once you delete all you duplicate files, do the following:
- Run the link validator to see which pages are affected (they'll probably show up as "download=1")
- Open each affected page
- Go into edit mode
- Switch to HTML view
- With the cursor in the editing field, hit Ctrl+A to select everything, then Ctrl+C to copy it
- Open up a plain-text editor--preferably one with a find and replace function. I used Typora
- Use Ctrl+V to paste the HTML code into the plain-text editor
- Search (Ctrl+F) for "file/" (no quotes). This will help you find the places where you should have files that are currently missing. You're looking for an 8-digit number.
- Start a find and replace. In a lot of applications, this is Ctrl+H
- In the find menu, put the 8-digit number. We'll call this the "problem number"
- (meanwhile) open the FILES section of the course. Click on the file you want to replace your duplicates with. (This will usually be the "original" file.)
- In the URL, toward the end, you'll have an 8-digit number. This is the code for that specific asset. It doesn't matter if you change the name of the file or (I believe) if you move it to another folder int he same class. This 8-digit number will point to this specific file.
- This number *should* be listed in the info for the file. But it isn't.
- Copy the 8-digit number. We'll call this the "original number"
- Put the "original number" in the "replace" field, and run it. It will now search for every instance of the "problem number" and replace it with the "original number."
- Repeat steps 8-14 for every other missing file on the page.
- When satisfied, Ctrl+A to select everything in the text editor, then switch back to the HTML view on the Canvas page you're editing.
- Delete everything in the Canvas page. Replace it with Ctrl+V.
- Hit save.
- If you did everything correctly, all your images/files are now manifesting correctly. Any alternate text or re-sizing you had done before deleting the duplicate files will still be applied to the updated files.
I figured this out, but now I'm copying a lot of my more frequently used files to the "user" category instead of the "class" category. Writing the line that refers to a "User file" instead of a "course file" is much more cumbersome but, I'm hoping, more stable. It might not be worth it.