# How to use ‘undo change timestamp’ custom rake task?

**URL:** <https://meta.discourse.org/t/how-to-use-undo-change-timestamp-custom-rake-task/309450>\
**Category:** Development\
**Created:** [May 26, 2024, 9:47am UTC](https://meta.discourse.org/t/how-to-use-undo-change-timestamp-custom-rake-task/309450 "2024-05-26T09:47:31Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![Dotila\_Li](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dotila_li/32/303426_2.png) [@Dotila\_Li](https://meta.discourse.org/u/Dotila_Li)\
**Post date:** [May 26, 2024, 9:47am UTC](https://meta.discourse.org/t/how-to-use-undo-change-timestamp-custom-rake-task/309450/1 "2024-05-26T09:47:31Z")

</div>

> [@Undo change timestamp](https://meta.discourse.org/t/undo-change-timestamp/78966):
>
> One of our mods changed the timestamp as a way to unbump a topic and I wanted to revert that change because. I wrote a rake task that does this. It’s a small thing, but why not share? # /var/www/discourse/lib/tasks/set\_timestamp\_to\_last\_version.rake desc "Set timestamp of all posts in a topic to the post's last\_version\_at" task "set\_timestamp\_to\_last\_version", [:topic\_id] =\> :environment do |\_, args| topic\_id = args[:topic\_id] if !topic\_id puts "ERROR: Expecting rake set\_timestamp\_to\_la…

How to run this in detail? I’m not familiar rake task.

I encountered this problem:

```plaintext
-bash: cd: /var/www/discourse: No such file or directory

```

---

_[View the full topic](https://meta.discourse.org/t/how-to-use-undo-change-timestamp-custom-rake-task/309450)._
